refactor from Binary centric model to global method model

This commit is contained in:
Jae Kwon
2014-09-03 20:41:57 -07:00
parent d0ec18dc16
commit e53b148acf
23 changed files with 624 additions and 692 deletions

View File

@ -6,6 +6,15 @@ type Binary interface {
WriteTo(w io.Writer) (int64, error)
}
func WriteBinary(w io.Writer, b Binary, n *int64, err *error) {
if *err != nil {
return
}
n_, err_ := b.WriteTo(w)
*n += int64(n_)
*err = err_
}
func WriteTo(w io.Writer, bz []byte, n *int64, err *error) {
if *err != nil {
return