-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsize.go
More file actions
41 lines (34 loc) · 729 Bytes
/
Copy pathsize.go
File metadata and controls
41 lines (34 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// size.go
//
// Created by Frederic DELBOS - fred@hyperboloide.com on Feb 10 2015.
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
//
package sprocess
import (
"errors"
"io"
)
type Size struct {
Name string
}
func (s *Size) GetName() string {
return s.Name
}
func (s *Size) Start() error {
if s.Name == "" {
return errors.New("Size must have a name")
}
return nil
}
func (s *Size) Encode(r io.Reader, w io.Writer, d *Data) error {
size, err := io.Copy(w, r)
d.Set(s.GetName(), size)
return err
}
func (s *Size) Decode(r io.Reader, w io.Writer, d *Data) error {
size, err := io.Copy(w, r)
d.Set(s.GetName(), size)
return err
}