// WriteTo satifies io.WriterTo interface. TypeId is not encoded. func (l *List) WriteTo(w io.Writer) (n int64, err error) { var nn int64 // Write TagType prefix tt := types.Int8(l.Typ) if nn, err = tt.WriteTo(w); err != nil { return } n += nn length := types.Int32(len(l.Value)) if nn, err = length.WriteTo(w); err != nil { return } n += nn for _, tag := range l.Value { if nn, err = tag.WriteTo(w); err != nil { return } n += nn } return }
func NewByteArray(s []int8) *ByteArray { b := &ByteArray{ Value: make([]types.Int8, len(s)), } for index, elem := range s { b.Value[index] = types.Int8(elem) } return b }
func (rw ReadWriter) WriteInt8(w io.Writer, value int8) { if rw.Err != nil { return } t := types.Int8(value) n, err := t.WriteTo(w) if err != nil { rw.Err = fmt.Errorf("WriteInt8: %v", err) return } rw.N += n }