Documentation
¶
Index ¶
- Variables
- type Bufferdeprecated
- func NewBuffer(buf []byte) *Bufferdeprecated
- func (b *Buffer) Bytes() []bytedeprecated
- func (b *Buffer) Err() errordeprecated
- func (b *Buffer) Read(p []byte) (n int, err error)deprecated
- func (b *Buffer) ReadBFloat32() (float32, error)deprecated
- func (b *Buffer) ReadBFloat64() (float64, error)deprecated
- func (b *Buffer) ReadBUint16() (uint16, error)deprecated
- func (b *Buffer) ReadBUint32() (uint32, error)deprecated
- func (b *Buffer) ReadBUint64() (uint64, error)deprecated
- func (b *Buffer) ReadBinary(u encoding.BinaryUnmarshaler, n int) errordeprecated
- func (b *Buffer) ReadByte() (byte, error)deprecated
- func (b *Buffer) ReadFrom(r io.Reader) (int64, error)deprecated
- func (b *Buffer) ReadLFloat32() (float32, error)deprecated
- func (b *Buffer) ReadLFloat64() (float64, error)deprecated
- func (b *Buffer) ReadLUint16() (uint16, error)deprecated
- func (b *Buffer) ReadLUint32() (uint32, error)deprecated
- func (b *Buffer) ReadLUint64() (uint64, error)deprecated
- func (b *Buffer) ReadUint8() (uint8, error)deprecated
- func (b *Buffer) Write(p []byte) (n int, err error)deprecated
- func (b *Buffer) WriteBFloat32(v float32) errordeprecated
- func (b *Buffer) WriteBFloat64(v float64) errordeprecated
- func (b *Buffer) WriteBUint16(v uint16) errordeprecated
- func (b *Buffer) WriteBUint32(v uint32) errordeprecated
- func (b *Buffer) WriteBUint64(v uint64) errordeprecated
- func (b *Buffer) WriteBinary(m encoding.BinaryMarshaler) errordeprecated
- func (b *Buffer) WriteByte(v byte) errordeprecated
- func (b *Buffer) WriteLFloat32(v float32) errordeprecated
- func (b *Buffer) WriteLFloat64(v float64) errordeprecated
- func (b *Buffer) WriteLUint16(v uint16) errordeprecated
- func (b *Buffer) WriteLUint32(v uint32) errordeprecated
- func (b *Buffer) WriteLUint64(v uint64) errordeprecated
- func (b *Buffer) WriteString(v string) errordeprecated
- func (b *Buffer) WriteTo(w io.Writer) (int64, error)deprecated
- func (b *Buffer) WriteUint8(v uint8) errordeprecated
- type DecBE
- func (d *DecBE) Bytes(n int) []byte
- func (d *DecBE) F32() float32
- func (d *DecBE) F64() float64
- func (d *DecBE) FromRF(r io.ReaderFrom)
- func (d *DecBE) I16() int16
- func (d *DecBE) I32() int32
- func (d *DecBE) I64() int64
- func (d *DecBE) I8() int8
- func (d *DecBE) ReadAll() []byte
- func (d *DecBE) Skip(n int)
- func (d *DecBE) U16() uint16
- func (d *DecBE) U32() uint32
- func (d *DecBE) U64() uint64
- func (d *DecBE) U8() uint8
- func (d *DecBE) Unmarshal(u encoding.BinaryUnmarshaler, n int)
- type DecLE
- func (d *DecLE) Bytes(n int) []byte
- func (d *DecLE) F32() float32
- func (d *DecLE) F64() float64
- func (d *DecLE) FromRF(r io.ReaderFrom)
- func (d *DecLE) I16() int16
- func (d *DecLE) I32() int32
- func (d *DecLE) I64() int64
- func (d *DecLE) I8() int8
- func (d *DecLE) ReadAll() []byte
- func (d *DecLE) Skip(n int)
- func (d *DecLE) U16() uint16
- func (d *DecLE) U32() uint32
- func (d *DecLE) U64() uint64
- func (d *DecLE) U8() uint8
- func (d *DecLE) Unmarshal(u encoding.BinaryUnmarshaler, n int)
- type EncBE
- func (e *EncBE) F32(v float32)
- func (e *EncBE) F64(v float64)
- func (e *EncBE) I16(v int16)
- func (e *EncBE) I32(v int32)
- func (e *EncBE) I64(v int64)
- func (e *EncBE) I8(v int8)
- func (e *EncBE) Marshal(m encoding.BinaryMarshaler)
- func (e *EncBE) To(w io.WriterTo)
- func (e *EncBE) U16(v uint16)
- func (e *EncBE) U32(v uint32)
- func (e *EncBE) U64(v uint64)
- func (e *EncBE) U8(v uint8)
- func (e *EncBE) Write(p []byte)
- type EncLE
- func (e *EncLE) F32(v float32)
- func (e *EncLE) F64(v float64)
- func (e *EncLE) I16(v int16)
- func (e *EncLE) I32(v int32)
- func (e *EncLE) I64(v int64)
- func (e *EncLE) I8(v int8)
- func (e *EncLE) Marshal(m encoding.BinaryMarshaler)
- func (e *EncLE) To(w io.WriterTo)
- func (e *EncLE) U16(v uint16)
- func (e *EncLE) U32(v uint32)
- func (e *EncLE) U64(v uint64)
- func (e *EncLE) U8(v uint8)
- func (e *EncLE) Write(p []byte)
- type Readerdeprecated
- func NewReader(r io.Reader) *Readerdeprecated
- func (r *Reader) Read(p []byte) (n int, err error)deprecated
- func (r *Reader) ReadBFloat32() (float32, error)deprecated
- func (r *Reader) ReadBFloat64() (float64, error)deprecated
- func (r *Reader) ReadBUint16() (uint16, error)deprecated
- func (r *Reader) ReadBUint32() (uint32, error)deprecated
- func (r *Reader) ReadBUint64() (uint64, error)deprecated
- func (r *Reader) ReadByte() (byte, error)deprecated
- func (r *Reader) ReadLFloat32() (float32, error)deprecated
- func (r *Reader) ReadLFloat64() (float64, error)deprecated
- func (r *Reader) ReadLUint16() (uint16, error)deprecated
- func (r *Reader) ReadLUint32() (uint32, error)deprecated
- func (r *Reader) ReadLUint64() (uint64, error)deprecated
- func (r *Reader) ReadUint8() (uint8, error)deprecated
Constants ¶
This section is empty.
Variables ¶
var ( Le = new(le) // Little-Endian functions Be = new(be) // Big-Endian functions )
Deprecated: Use EncLE/DecLE and EncBE/DecBE instead. These global variables will be removed in a future version.
Functions ¶
This section is empty.
Types ¶
type Buffer
deprecated
type Buffer struct {
// contains filtered or unexported fields
}
Deprecated: Use EncLE/DecLE and EncBE/DecBE instead. Buffer will be removed in a future version. Buffer wraps `bytes.Buffer` and provides serialization methods on top of it.
func (*Buffer) Read
deprecated
func (*Buffer) ReadBFloat32
deprecated
func (*Buffer) ReadBFloat64
deprecated
added in
v0.1.2
func (*Buffer) ReadBUint16
deprecated
func (*Buffer) ReadBUint32
deprecated
func (*Buffer) ReadBUint64
deprecated
func (*Buffer) ReadBinary
deprecated
added in
v0.2.0
func (b *Buffer) ReadBinary(u encoding.BinaryUnmarshaler, n int) error
Deprecated: Use EncLE/DecLE and EncBE/DecBE instead. ReadBinary will be removed in a future version. ReadBinary reads exactly n bytes and calls UnmarshalBinary.
func (*Buffer) ReadLFloat32
deprecated
func (*Buffer) ReadLFloat64
deprecated
added in
v0.1.2
func (*Buffer) ReadLUint16
deprecated
func (*Buffer) ReadLUint32
deprecated
func (*Buffer) ReadLUint64
deprecated
func (*Buffer) WriteBFloat32
deprecated
func (*Buffer) WriteBFloat64
deprecated
func (*Buffer) WriteBUint16
deprecated
func (*Buffer) WriteBUint32
deprecated
func (*Buffer) WriteBUint64
deprecated
func (*Buffer) WriteBinary
deprecated
added in
v0.2.0
func (b *Buffer) WriteBinary(m encoding.BinaryMarshaler) error
Deprecated: Use EncLE/DecLE and EncBE/DecBE instead. WriteBinary will be removed in a future version. WriteBinary writes raw MarshalBinary bytes. No length prefix.
func (*Buffer) WriteLFloat32
deprecated
func (*Buffer) WriteLFloat64
deprecated
func (*Buffer) WriteLUint16
deprecated
func (*Buffer) WriteLUint32
deprecated
func (*Buffer) WriteLUint64
deprecated
func (*Buffer) WriteString
deprecated
func (*Buffer) WriteUint8
deprecated
type DecBE ¶ added in v0.2.0
type DecBE struct {
R io.Reader // The underlying reader to decode data from
N int64 // Number of bytes read
Err error // First error encountered during decoding
}
DecBE is a big-endian binary decoder that reads data from an io.Reader. It tracks the number of bytes read and any errors that occur during decoding.
func NewDecBE ¶ added in v0.2.0
NewDecBE creates a new big-endian decoder that reads from the provided io.Reader.
func (*DecBE) Bytes ¶ added in v0.2.0
Bytes reads n bytes from the decoder and returns them as a byte slice.
func (*DecBE) F32 ¶ added in v0.2.0
F32 decodes a float32 value from big-endian format using IEEE 754 representation.
func (*DecBE) F64 ¶ added in v0.2.0
F64 decodes a float64 value from big-endian format using IEEE 754 representation.
func (*DecBE) FromRF ¶ added in v0.2.0
func (d *DecBE) FromRF(r io.ReaderFrom)
FromRF calls ReadFrom on the provided ReaderFrom and updates the decoder's byte count and error state.
func (*DecBE) ReadAll ¶ added in v0.2.3
ReadAll reads all remaining bytes from the decoder until EOF. It updates the decoder's byte count and error state.
type DecLE ¶ added in v0.2.0
type DecLE struct {
R io.Reader // The underlying reader to decode data from
N int64 // Number of bytes read
Err error // First error encountered during decoding
}
DecLE is a little-endian binary decoder that reads data from an io.Reader. It tracks the number of bytes read and any errors that occur during decoding.
func NewDecLE ¶ added in v0.2.0
NewDecLE creates a new little-endian decoder that reads from the provided io.Reader.
func (*DecLE) Bytes ¶ added in v0.2.0
Bytes reads n bytes from the decoder and returns them as a byte slice.
func (*DecLE) F32 ¶ added in v0.2.0
F32 decodes a float32 value from little-endian format using IEEE 754 representation.
func (*DecLE) F64 ¶ added in v0.2.0
F64 decodes a float64 value from little-endian format using IEEE 754 representation.
func (*DecLE) FromRF ¶ added in v0.2.0
func (d *DecLE) FromRF(r io.ReaderFrom)
FromRF calls ReadFrom on the provided ReaderFrom and updates the decoder's byte count and error state.
func (*DecLE) ReadAll ¶ added in v0.2.3
ReadAll reads all remaining bytes from the decoder until EOF. It updates the decoder's byte count and error state.
type EncBE ¶ added in v0.2.1
type EncBE struct {
W io.Writer // The underlying writer to encode data to
N int64 // Number of bytes written
Err error // First error encountered during encoding
}
EncBE is a big-endian binary encoder that writes data to an io.Writer. It tracks the number of bytes written and any errors that occur during encoding.
func NewEncBE ¶ added in v0.2.1
NewEncBE creates a new big-endian encoder that writes to the provided io.Writer.
func NewEncBEBuffer ¶ added in v0.2.2
func NewEncBEBuffer() *EncBE
NewEncBEBuffer creates an encoder that writes to a new bytes.Buffer
func NewEncBEFromBytes ¶ added in v0.2.2
NewEncBEFromBytes creates an encoder that writes to a buffer initialized with existing data
func NewEncBEWithCapacity ¶ added in v0.2.2
NewEncBEWithCapacity creates an encoder that writes to a buffer with pre-allocated capacity
func (*EncBE) F32 ¶ added in v0.2.1
F32 encodes a float32 value in big-endian format using IEEE 754 representation.
func (*EncBE) F64 ¶ added in v0.2.1
F64 encodes a float64 value in big-endian format using IEEE 754 representation.
func (*EncBE) Marshal ¶ added in v0.2.1
func (e *EncBE) Marshal(m encoding.BinaryMarshaler)
Marshal calls MarshalBinary on the provided BinaryMarshaler and writes the result to the encoder. It updates the encoder's byte count and error state.
func (*EncBE) To ¶ added in v0.2.1
To calls WriteTo on the provided WriterTo and updates the encoder's byte count and error state.
type EncLE ¶ added in v0.2.1
type EncLE struct {
W io.Writer // The underlying writer to encode data to
N int64 // Number of bytes written
Err error // First error encountered during encoding
}
EncLE is a little-endian binary encoder that writes data to an io.Writer. It tracks the number of bytes written and any errors that occur during encoding.
func NewEncLE ¶ added in v0.2.1
NewEncLE creates a new little-endian encoder that writes to the provided io.Writer.
func NewEncLEBuffer ¶ added in v0.2.2
func NewEncLEBuffer() *EncLE
NewEncLEBuffer creates an encoder that writes to a new bytes.Buffer
func NewEncLEFromBytes ¶ added in v0.2.2
NewEncLEFromBytes creates an encoder that writes to a buffer initialized with existing data
func NewEncLEWithCapacity ¶ added in v0.2.2
NewEncLEWithCapacity creates an encoder that writes to a buffer with pre-allocated capacity
func (*EncLE) F32 ¶ added in v0.2.1
F32 encodes a float32 value in little-endian format using IEEE 754 representation.
func (*EncLE) F64 ¶ added in v0.2.1
F64 encodes a float64 value in little-endian format using IEEE 754 representation.
func (*EncLE) Marshal ¶ added in v0.2.1
func (e *EncLE) Marshal(m encoding.BinaryMarshaler)
Marshal calls MarshalBinary on the provided BinaryMarshaler and writes the result to the encoder. It updates the encoder's byte count and error state.
func (*EncLE) To ¶ added in v0.2.1
To calls WriteTo on the provided WriterTo and updates the encoder's byte count and error state.
type Reader
deprecated
type Reader struct {
// contains filtered or unexported fields
}
Deprecated: Use DecLE/DecBE instead. Reader will be removed in a future version. Reader wraps an io.Reader and provides serialization methods on top of it.