type Decoder … // NewDecoder returns a new decoder that reads and decodes from r using // the default decoding options. func NewDecoder(r io.Reader) *Decoder { … } // Decode reads CBOR value and decodes it into the value pointed to by v. func (dec *Decoder) Decode(v interface{ … } // Skip skips to the next CBOR data item (if there is any), // otherwise it returns error such as io.EOF, io.UnexpectedEOF, etc. func (dec *Decoder) Skip() error { … } // NumBytesRead returns the number of bytes read. func (dec *Decoder) NumBytesRead() int { … } // Buffered returns a reader for data remaining in Decoder's buffer. // Returned reader is valid until the next call to Decode or Skip. func (dec *Decoder) Buffered() io.Reader { … } // readNext() reads next CBOR data item from Reader to buffer. // It returns the size of next CBOR data item. // It also returns validation error or read error if any. func (dec *Decoder) readNext() (int, error) { … } // read() reads data from Reader to buffer. // It returns number of bytes read and any read error encountered. // Postconditions: // - dec.buf contains previously unread data and new data. // - dec.off is 0. func (dec *Decoder) read() (int, error) { … } func (dec *Decoder) overwriteBuf(newBuf []byte) { … } type Encoder … // NewEncoder returns a new encoder that writes to w using the default encoding options. func NewEncoder(w io.Writer) *Encoder { … } // Encode writes the CBOR encoding of v. func (enc *Encoder) Encode(v interface{ … } // StartIndefiniteByteString starts byte string encoding of indefinite length. // Subsequent calls of (*Encoder).Encode() encodes definite length byte strings // ("chunks") as one contiguous string until EndIndefinite is called. func (enc *Encoder) StartIndefiniteByteString() error { … } // StartIndefiniteTextString starts text string encoding of indefinite length. // Subsequent calls of (*Encoder).Encode() encodes definite length text strings // ("chunks") as one contiguous string until EndIndefinite is called. func (enc *Encoder) StartIndefiniteTextString() error { … } // StartIndefiniteArray starts array encoding of indefinite length. // Subsequent calls of (*Encoder).Encode() encodes elements of the array // until EndIndefinite is called. func (enc *Encoder) StartIndefiniteArray() error { … } // StartIndefiniteMap starts array encoding of indefinite length. // Subsequent calls of (*Encoder).Encode() encodes elements of the map // until EndIndefinite is called. func (enc *Encoder) StartIndefiniteMap() error { … } // EndIndefinite closes last opened indefinite length value. func (enc *Encoder) EndIndefinite() error { … } var cborIndefHeader … func (enc *Encoder) startIndefinite(typ cborType) error { … } type RawMessage … // MarshalCBOR returns m or CBOR nil if m is nil. func (m RawMessage) MarshalCBOR() ([]byte, error) { … } // UnmarshalCBOR creates a copy of data and saves to *m. func (m *RawMessage) UnmarshalCBOR(data []byte) error { … }