예제 #1
0
func (rw MustReadWriter) WriteObjectData(w io.Writer, value *mct.ObjectData) {
	if rw.Err != nil {
		return
	}

	n, err := value.WriteTo(w)
	if err != nil {
		rw.Err = fmt.Errorf("WriteObjectData: %s", err)
		return
	}
	rw.N += n
}
예제 #2
0
func (rw MustReadWriter) ReadObjectData(r io.Reader) (res *mct.ObjectData) {
	if rw.Err != nil {
		return
	}

	t := new(mct.ObjectData)
	n, err := t.ReadFrom(r)
	if err != nil {
		rw.Err = fmt.Errorf("ReadObjectData: %s", err)
		return
	}
	rw.N += n

	return t
}