Ejemplo n.º 1
0
// Read a (length prefixed) byteslice then decode the object using the codec
func decodeByteSlice(codec binary.Codec, r io.Reader, n *int64, err *error) interface{} {
	bytez := binary.ReadByteSlice(r, n, err)
	if *err != nil {
		return nil
	}
	n_ := new(int64)
	return codec.Decode(bytes.NewBuffer(bytez), n_, err)
}