You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
553 B

package binary
import "io"
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
}
n_, err_ := w.Write(bz)
*n += int64(n_)
*err = err_
}
func ReadFull(r io.Reader, buf []byte, n *int64, err *error) {
if *err != nil {
return
}
n_, err_ := io.ReadFull(r, buf)
*n += int64(n_)
*err = err_
}