Documentation
¶
Index ¶
- type Buffer
- func (b *Buffer) AdjustWriteCursor(offset int) error
- func (b *Buffer) Capacity() int
- func (b *Buffer) Compact()
- func (b *Buffer) Peek(dst []byte) (int, error)
- func (b *Buffer) PeekExactly(dst []byte) error
- func (b *Buffer) Read(dst []byte) (int, error)
- func (b *Buffer) ReadAll() []byte
- func (b *Buffer) ReadBool() (bool, error)
- func (b *Buffer) ReadExactly(dst []byte) error
- func (b *Buffer) ReadFloat32() (float32, error)
- func (b *Buffer) ReadFloat32Le() (float32, error)
- func (b *Buffer) ReadFloat64() (float64, error)
- func (b *Buffer) ReadFloat64Le() (float64, error)
- func (b *Buffer) ReadInt16() (int16, error)
- func (b *Buffer) ReadInt16Le() (int16, error)
- func (b *Buffer) ReadInt32() (int32, error)
- func (b *Buffer) ReadInt32Le() (int32, error)
- func (b *Buffer) ReadInt64() (int64, error)
- func (b *Buffer) ReadInt64Le() (int64, error)
- func (b *Buffer) ReadLengthPrefixedString() (string, error)
- func (b *Buffer) ReadLengthPrefixedStringLe() (string, error)
- func (b *Buffer) ReadNBytes(n int) ([]byte, error)
- func (b *Buffer) ReadString(length int) (string, error)
- func (b *Buffer) ReadUInt16() (uint16, error)
- func (b *Buffer) ReadUInt16Le() (uint16, error)
- func (b *Buffer) ReadUInt32() (uint32, error)
- func (b *Buffer) ReadUInt32Le() (uint32, error)
- func (b *Buffer) ReadUInt64() (uint64, error)
- func (b *Buffer) ReadUInt64Le() (uint64, error)
- func (b *Buffer) ReadableSize() int
- func (b *Buffer) Skip(offset int) error
- func (b *Buffer) WritableSlice() []byte
- func (b *Buffer) Write(p []byte) (int, error)
- func (b *Buffer) WriteBool(x bool) error
- func (b *Buffer) WriteExactly(p []byte) error
- func (b *Buffer) WriteFloat32(f float32) error
- func (b *Buffer) WriteFloat32Le(f float32) error
- func (b *Buffer) WriteFloat64(f float64) error
- func (b *Buffer) WriteFloat64Le(f float64) error
- func (b *Buffer) WriteInt16(x int16) error
- func (b *Buffer) WriteInt16Le(x int16) error
- func (b *Buffer) WriteInt32(x int32) error
- func (b *Buffer) WriteInt32Le(x int32) error
- func (b *Buffer) WriteInt64(x int64) error
- func (b *Buffer) WriteInt64Le(x int64) error
- func (b *Buffer) WriteLengthPrefixedString(s string) error
- func (b *Buffer) WriteLengthPrefixedStringLe(s string) error
- func (b *Buffer) WriteString(s string) error
- func (b *Buffer) WriteUInt16(x uint16) error
- func (b *Buffer) WriteUInt16Le(x uint16) error
- func (b *Buffer) WriteUInt32(x uint32) error
- func (b *Buffer) WriteUInt32Le(x uint32) error
- func (b *Buffer) WriteUInt64(x uint64) error
- func (b *Buffer) WriteUInt64Le(x uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func NewBufferFromBytes ¶
func (*Buffer) AdjustWriteCursor ¶
func (*Buffer) PeekExactly ¶
func (*Buffer) ReadBool ¶
ReadBool reads a boolean value from the buffer. It assumes that a boolean is stored as a single byte (0 for false, 1 for true).
func (*Buffer) ReadExactly ¶
func (*Buffer) ReadFloat32 ¶
ReadFloat32 reads a float32 value in big-endian format from the buffer.
func (*Buffer) ReadFloat32Le ¶
ReadFloat32Le reads a float32 value in little-endian format from the buffer.
func (*Buffer) ReadFloat64 ¶
ReadFloat64 reads a float64 value in big-endian format from the buffer.
func (*Buffer) ReadFloat64Le ¶
ReadFloat64Le reads a float64 value in little-endian format from the buffer.
func (*Buffer) ReadInt16Le ¶
func (*Buffer) ReadInt32Le ¶
func (*Buffer) ReadInt64Le ¶
func (*Buffer) ReadLengthPrefixedString ¶
ReadLengthPrefixedString reads a string in big-endian format. It first reads the length (uint32), then the string data.
func (*Buffer) ReadLengthPrefixedStringLe ¶
ReadLengthPrefixedStringLe reads a string in little-endian format. First, it reads the length (uint32), then the string data.
func (*Buffer) ReadString ¶
ReadString reads a string of the specified length.
func (*Buffer) ReadUInt16 ¶
func (*Buffer) ReadUInt16Le ¶
func (*Buffer) ReadUInt32 ¶
func (*Buffer) ReadUInt32Le ¶
func (*Buffer) ReadUInt64 ¶
func (*Buffer) ReadUInt64Le ¶
func (*Buffer) ReadableSize ¶
func (*Buffer) WritableSlice ¶
func (*Buffer) WriteBool ¶
WriteBool writes a boolean value to the buffer. It stores the boolean as a single byte (0 for false, 1 for true).
func (*Buffer) WriteExactly ¶
func (*Buffer) WriteFloat32 ¶
WriteFloat32 writes a float32 value in big-endian format to the buffer.
func (*Buffer) WriteFloat32Le ¶
WriteFloat32Le writes a float32 value in little-endian format to the buffer.
func (*Buffer) WriteFloat64 ¶
WriteFloat64 writes a float64 value in big-endian format to the buffer.
func (*Buffer) WriteFloat64Le ¶
WriteFloat64Le writes a float64 value in little-endian format to the buffer.
func (*Buffer) WriteInt16 ¶
func (*Buffer) WriteInt16Le ¶
func (*Buffer) WriteInt32 ¶
func (*Buffer) WriteInt32Le ¶
func (*Buffer) WriteInt64 ¶
func (*Buffer) WriteInt64Le ¶
func (*Buffer) WriteLengthPrefixedString ¶
WriteLengthPrefixedString writes a string in big-endian format. It writes the length (uint32), followed by the string data.
func (*Buffer) WriteLengthPrefixedStringLe ¶
WriteLengthPrefixedStringLe writes a string in little-endian format. It writes the length (uint32), followed by the string data.
func (*Buffer) WriteString ¶
WriteString writes the string data to the buffer.