Versions in this module Expand all Collapse all v1 v1.0.6 Mar 17, 2026 v1.0.5 Mar 17, 2026 Changes in this version + func Align(w io.Writer, n, align int64) (int64, error) + type BigEndian struct + func (BigEndian) ByteOrder() binary.ByteOrder + type Endianness interface + ByteOrder func() binary.ByteOrder + type LittleEndian struct + func (LittleEndian) ByteOrder() binary.ByteOrder v1.0.4 Mar 14, 2026 v1.0.3 Dec 18, 2025 Changes in this version type BytesReader + func (r *BytesReader) Next(n int) []byte v1.0.2 Dec 10, 2025 Changes in this version + func CheckBufferNotZeros(trailingData []byte) error v1.0.0 Nov 29, 2025 Changes in this version + const BUFFER_SIZE + const CHUNK_SIZE + const MAX_PADDING + var BE = binary.BigEndian + var ErrAlreadyBuffered = errors.New("codec: reader or writer is already buffered") + var ErrDiscardNegative = errors.New("codec: cannot discard negative number of bytes") + var ErrInvalidRead = errors.New("codec: reader returned invalid count from Read") + var ErrInvalidSeek = errors.New("codec: seek to a invalid position") + var ErrInvalidWhence = errors.New("codec: unsupported whence for forward-only seeker") + var ErrInvalidWrite = errors.New("codec: writer returned invalid count from Write") + var ErrNilIO = errors.New("codec: NewReader/NewWriter called with a nil io.Reader/io.Writer") + var ErrReadToNil = errors.New("codec: ReadTo called with a nil io.ReaderFrom") + var ErrSizeTooSmall = errors.New("codec: NewReaderSize with a size smaller than 16 conflict with bufio") + var ErrTrailingData = errors.New("codec: non-zero trailing data found after decoding") + var ErrTruncatedData = errors.New("codec: truncated data") + var ErrUnsupportedNegativeSeek = errors.New("codec: unsupported negative offset for forward-only seeker") + var ErrWriteToNil = errors.New("codec: WriteTo called with a nil io.Writer") + var LE = binary.LittleEndian + var Order = BE + var Zero io.Reader = zero + func ChainReader(reader io.Reader, n int64, callback ChainedReaderCallback) reader + func CheckTrailingNotZeros(r io.Reader) error + func Discard(r io.Reader, n int64) (int64, error) + func ForwardSeekCloser(r io.ReadCloser) io.ReadSeekCloser + func ForwardSeeker(r io.Reader) io.ReadSeeker + func LimitReader(r io.Reader, n int64) reader + func MarshalBinaryGeneric[T interface{ ... }](v T) ([]byte, error) + func MarshalToGeneric[T interface{ ... }](v T, p []byte) (int, error) + func NewList[T Codec](items []T, options *listOptions) *list[T] + func Ptr[T any](v T) *T + func ReadFromGeneric[T encoding.BinaryUnmarshaler](v T, r io.Reader) (int64, error) + func ReadUTF16StringUntilNull(r io.Reader) (string, int64, error) + func ReadUntilNullOrEOF(r io.Reader) ([]byte, int64, error) + func ReadVariableField(r io.Reader, currentReadOffset, targetFieldOffset, targetFieldLength int64) ([]byte, int64, error) + func ReadVariableFieldStream(dst io.Writer, r io.Reader, ...) (int64, error) + func Roundup[T constraints.Integer](n, align T) T + func UnmarshalBinaryGeneric[T interface{ ... }](v T, data []byte) error + func WriteToGeneric[T encoding.BinaryMarshaler](v T, w io.Writer) (int64, error) + type BytesReader struct + B []byte + N int + func NewBytesReader(b []byte) *BytesReader + func (r *BytesReader) Available() int + func (r *BytesReader) Close() error + func (r *BytesReader) Read(p []byte) (int, error) + func (r *BytesReader) ReadByte() (byte, error) + func (r *BytesReader) Seek(offset int64, whence int) (int64, error) + func (r *BytesReader) Size() int + func (r *BytesReader) WriteTo(w io.Writer) (int64, error) + func (w *BytesReader) Len() int + func (w *BytesReader) Reset() + type BytesWriter struct + B []byte + N int + func NewBytesWriter(p []byte) *BytesWriter + func (w *BytesWriter) Available() int + func (w *BytesWriter) Bytes() []byte + func (w *BytesWriter) Close() error + func (w *BytesWriter) Flush() error + func (w *BytesWriter) Len() int + func (w *BytesWriter) ReadFrom(r io.Reader) (int64, error) + func (w *BytesWriter) Reset() + func (w *BytesWriter) Size() int + func (w *BytesWriter) Write(p []byte) (int, error) + func (w *BytesWriter) WriteByte(c byte) error + func (w *BytesWriter) WriteString(s string) (int, error) + func (w *BytesWriter) WriteZeros(n int) (int, error) + type ChainedReadSeeker struct + S io.Seeker + func (r *ChainedReadSeeker) Seek(offset int64, whence int) (int64, error) + type ChainedReader struct + C ChainedReaderCallback + E bool + N int64 + R *io.LimitedReader + U io.Reader + func (r *ChainedReader) Close() error + func (r *ChainedReader) Read(p []byte) (n int, err error) + func (r *ChainedReader) WriteTo(w io.Writer) (n int64, err error) + type ChainedReaderCallback func(trailerReader io.Reader) error + type Codec interface + type Fixed struct + Payload Payload + func (c *Fixed[Payload]) MarshalBinary() ([]byte, error) + func (c *Fixed[Payload]) MarshalTo(p []byte) (int, error) + func (c *Fixed[Payload]) ReadFrom(r io.Reader) (int64, error) + func (c *Fixed[Payload]) Size() int + func (c *Fixed[Payload]) UnmarshalBinary(data []byte) error + func (c *Fixed[Payload]) WriteTo(w io.Writer) (int64, error) + type LimitedReader struct + func (r *LimitedReader) Close() error + func (r *LimitedReader) WriteTo(w io.Writer) (n int64, err error) + type List interface + Codecs func() []Codec + Len func() int + type List0 struct + func NewList0[T Codec](items []T) *List0[T] + func (l *List0) Codecs() []Codec + func (l *List0) Len() int + func (l *List0) MarshalBinary() ([]byte, error) + func (l *List0) MarshalTo(buf []byte) (int, error) + func (l *List0) ReadFrom(reader io.Reader) (int64, error) + func (l *List0) Size() int + func (l *List0) UnmarshalBinary(data []byte) error + func (l *List0) WriteTo(writer io.Writer) (int64, error) + type List4 struct + func NewList4[T Codec](items []T) *List4[T] + func (l *List4) Codecs() []Codec + func (l *List4) Len() int + func (l *List4) MarshalBinary() ([]byte, error) + func (l *List4) MarshalTo(buf []byte) (int, error) + func (l *List4) ReadFrom(reader io.Reader) (int64, error) + func (l *List4) Size() int + func (l *List4) UnmarshalBinary(data []byte) error + func (l *List4) WriteTo(writer io.Writer) (int64, error) + type List8 struct + func NewList8[T Codec](items []T) *List8[T] + func (l *List8) Codecs() []Codec + func (l *List8) Len() int + func (l *List8) MarshalBinary() ([]byte, error) + func (l *List8) MarshalTo(buf []byte) (int, error) + func (l *List8) ReadFrom(reader io.Reader) (int64, error) + func (l *List8) Size() int + func (l *List8) UnmarshalBinary(data []byte) error + func (l *List8) WriteTo(writer io.Writer) (int64, error) + type Marshaler interface + MarshalTo func(buf []byte) (int, error) + type PeekableReader struct + B []byte + R io.Reader + func PeekReader(r io.Reader) *PeekableReader + func (r *PeekableReader) Close() error + func (r *PeekableReader) Peek(n int) ([]byte, error) + func (r *PeekableReader) Read(p []byte) (n int, err error) + func (r *PeekableReader) WriteTo(w io.Writer) (n int64, err error) + type Reader struct + func NewReader(r io.Reader) (*Reader, error) + func NewReaderSize(r io.Reader, size int) (*Reader, error) + func (r *Reader) Align(n int) + func (r *Reader) Close() error + func (r *Reader) Count() int64 + func (r *Reader) Err() error + func (r *Reader) IsEOF() bool + func (r *Reader) Read(p []byte) (int, error) + func (r *Reader) ReadBool(dest *bool) + func (r *Reader) ReadByte() (byte, error) + func (r *Reader) ReadBytes(n int) []byte + func (r *Reader) ReadBytesTo(dest []byte) + func (r *Reader) ReadInt16(dest *int16) + func (r *Reader) ReadInt32(dest *int32) + func (r *Reader) ReadInt64(dest *int64) + func (r *Reader) ReadInt8(dest *int8) + func (r *Reader) ReadTo(w io.ReaderFrom) + func (r *Reader) ReadUint16(dest *uint16) + func (r *Reader) ReadUint32(dest *uint32) + func (r *Reader) ReadUint64(dest *uint64) + func (r *Reader) ReadUint8(dest *uint8) + func (r *Reader) Result() (int64, error) + func (r *Reader) Seek(offset int64, whence int) (int64, error) + func (r *Reader) Size() int + func (r *Reader) WithByteOrder(order binary.ByteOrder) *Reader + func (r *Reader) WriteTo(w io.Writer) (int64, error) + type ReaderPro interface + Size func() int + type Sizer interface + Size func() int + type Unmarshaler interface + type Writer struct + func NewWriter(w io.Writer) (*Writer, error) + func NewWriterSize(w io.Writer, size int) (*Writer, error) + func (w *Writer) Align(n int) + func (w *Writer) Close() error + func (w *Writer) Count() int64 + func (w *Writer) Err() error + func (w *Writer) Flush() error + func (w *Writer) ReadFrom(r io.Reader) (int64, error) + func (w *Writer) Result() (int64, error) + func (w *Writer) Size() int + func (w *Writer) WithByteOrder(order binary.ByteOrder) *Writer + func (w *Writer) Write(buf []byte) (int, error) + func (w *Writer) WriteBool(v bool) + func (w *Writer) WriteByte(v byte) error + func (w *Writer) WriteBytes(buf []byte) + func (w *Writer) WriteFrom(wt io.WriterTo) + func (w *Writer) WriteInt16(v int16) + func (w *Writer) WriteInt32(v int32) + func (w *Writer) WriteInt64(v int64) + func (w *Writer) WriteInt8(v int8) + func (w *Writer) WriteString(str string) (int, error) + func (w *Writer) WriteUint16(v uint16) + func (w *Writer) WriteUint32(v uint32) + func (w *Writer) WriteUint64(v uint64) + func (w *Writer) WriteUint8(v uint8) + func (w *Writer) WriteZeros(n int64) + type WriterPro interface + Flush func() error + Size func() int