Documentation
¶
Index ¶
- Variables
- type ByteBuf
- type DefaultByteBuf
- func (b *DefaultByteBuf) AppendByte(c byte) ByteBuf
- func (b *DefaultByteBuf) Bytes() []byte
- func (b *DefaultByteBuf) BytesCopy() []byte
- func (b *DefaultByteBuf) Cap() int
- func (b *DefaultByteBuf) Clone() ByteBuf
- func (b *DefaultByteBuf) Close() error
- func (b *DefaultByteBuf) Compact() ByteBuf
- func (b *DefaultByteBuf) EnsureCapacity(n int) ByteBuf
- func (b *DefaultByteBuf) Grow(v int) ByteBuf
- func (b *DefaultByteBuf) MarkReaderIndex() ByteBuf
- func (b *DefaultByteBuf) MarkWriterIndex() ByteBuf
- func (b *DefaultByteBuf) MustReadByte() byte
- func (b *DefaultByteBuf) Read(p []byte) (n int, err error)
- func (b *DefaultByteBuf) ReadByte() (byte, error)
- func (b *DefaultByteBuf) ReadByteBuf(len int) ByteBuf
- func (b *DefaultByteBuf) ReadBytes(len int) []byte
- func (b *DefaultByteBuf) ReadFloat32() float32
- func (b *DefaultByteBuf) ReadFloat32LE() float32
- func (b *DefaultByteBuf) ReadFloat64() float64
- func (b *DefaultByteBuf) ReadFloat64LE() float64
- func (b *DefaultByteBuf) ReadInt16() int16
- func (b *DefaultByteBuf) ReadInt16LE() int16
- func (b *DefaultByteBuf) ReadInt32() int32
- func (b *DefaultByteBuf) ReadInt32LE() int32
- func (b *DefaultByteBuf) ReadInt64() int64
- func (b *DefaultByteBuf) ReadInt64LE() int64
- func (b *DefaultByteBuf) ReadUInt16() uint16
- func (b *DefaultByteBuf) ReadUInt16LE() uint16
- func (b *DefaultByteBuf) ReadUInt32() uint32
- func (b *DefaultByteBuf) ReadUInt32LE() uint32
- func (b *DefaultByteBuf) ReadUInt64() uint64
- func (b *DefaultByteBuf) ReadUInt64LE() uint64
- func (b *DefaultByteBuf) ReadWriter(writer io.Writer) ByteBuf
- func (b *DefaultByteBuf) ReadableBytes() int
- func (b *DefaultByteBuf) ReaderIndex() int
- func (b *DefaultByteBuf) Reset() ByteBuf
- func (b *DefaultByteBuf) ResetReaderIndex() ByteBuf
- func (b *DefaultByteBuf) ResetWriterIndex() ByteBuf
- func (b *DefaultByteBuf) Skip(v int) ByteBuf
- func (b *DefaultByteBuf) Write(p []byte) (n int, err error)
- func (b *DefaultByteBuf) WriteAt(p []byte, offset int64) (n int, err error)
- func (b *DefaultByteBuf) WriteByte(c byte) error
- func (b *DefaultByteBuf) WriteByteBuf(buf ByteBuf) ByteBuf
- func (b *DefaultByteBuf) WriteBytes(bs []byte) ByteBuf
- func (b *DefaultByteBuf) WriteFloat32(v float32) ByteBuf
- func (b *DefaultByteBuf) WriteFloat32LE(v float32) ByteBuf
- func (b *DefaultByteBuf) WriteFloat64(v float64) ByteBuf
- func (b *DefaultByteBuf) WriteFloat64LE(v float64) ByteBuf
- func (b *DefaultByteBuf) WriteInt16(v int16) ByteBuf
- func (b *DefaultByteBuf) WriteInt16LE(v int16) ByteBuf
- func (b *DefaultByteBuf) WriteInt32(v int32) ByteBuf
- func (b *DefaultByteBuf) WriteInt32LE(v int32) ByteBuf
- func (b *DefaultByteBuf) WriteInt64(v int64) ByteBuf
- func (b *DefaultByteBuf) WriteInt64LE(v int64) ByteBuf
- func (b *DefaultByteBuf) WriteReader(reader io.Reader) ByteBuf
- func (b *DefaultByteBuf) WriteString(s string) ByteBuf
- func (b *DefaultByteBuf) WriteUInt16(v uint16) ByteBuf
- func (b *DefaultByteBuf) WriteUInt16LE(v uint16) ByteBuf
- func (b *DefaultByteBuf) WriteUInt32(v uint32) ByteBuf
- func (b *DefaultByteBuf) WriteUInt32LE(v uint32) ByteBuf
- func (b *DefaultByteBuf) WriteUInt64(v uint64) ByteBuf
- func (b *DefaultByteBuf) WriteUInt64LE(v uint64) ByteBuf
- func (b *DefaultByteBuf) WriterIndex() int
Constants ¶
This section is empty.
Variables ¶
var ErrInsufficientSize = errors.New("insufficient size")
var ErrNilObject = errors.New("nil object")
Functions ¶
This section is empty.
Types ¶
type ByteBuf ¶
type ByteBuf interface {
io.Writer
io.Reader
io.Closer
io.WriterAt
ReaderIndex() int
WriterIndex() int
MarkReaderIndex() ByteBuf
ResetReaderIndex() ByteBuf
MarkWriterIndex() ByteBuf
ResetWriterIndex() ByteBuf
Reset() ByteBuf
Bytes() []byte
BytesCopy() []byte
ReadableBytes() int
Cap() int
Grow(v int) ByteBuf
// Compact moves the readable region to the beginning of the buffer and adjusts indices (including marked indices).
Compact() ByteBuf
// EnsureCapacity guarantees that at least n bytes of writable space are available.
// It first tries to compact; if still insufficient, it grows using the existing doubling policy and compacts again.
EnsureCapacity(n int) ByteBuf
Skip(v int) ByteBuf
Clone() ByteBuf
// AppendByte appends a single byte and returns the ByteBuf for chaining
AppendByte(c byte) ByteBuf
WriteBytes(bs []byte) ByteBuf
WriteString(s string) ByteBuf
WriteByteBuf(buf ByteBuf) ByteBuf
WriteReader(reader io.Reader) ByteBuf
WriteInt16(v int16) ByteBuf
WriteInt32(v int32) ByteBuf
WriteInt64(v int64) ByteBuf
WriteUInt16(v uint16) ByteBuf
WriteUInt32(v uint32) ByteBuf
WriteUInt64(v uint64) ByteBuf
WriteFloat32(v float32) ByteBuf
WriteFloat64(v float64) ByteBuf
WriteInt16LE(v int16) ByteBuf
WriteInt32LE(v int32) ByteBuf
WriteInt64LE(v int64) ByteBuf
WriteUInt16LE(v uint16) ByteBuf
WriteUInt32LE(v uint32) ByteBuf
WriteUInt64LE(v uint64) ByteBuf
WriteFloat32LE(v float32) ByteBuf
WriteFloat64LE(v float64) ByteBuf
// Standard Go io.ByteWriter interface
WriteByte(c byte) error
// MustReadByte reads a single byte and panics if insufficient data (existing behavior)
MustReadByte() byte
// Standard Go io.ByteReader interface
ReadByte() (byte, error)
ReadBytes(len int) []byte
ReadByteBuf(len int) ByteBuf
ReadWriter(writer io.Writer) ByteBuf
ReadInt16() int16
ReadInt32() int32
ReadInt64() int64
ReadUInt16() uint16
ReadUInt32() uint32
ReadUInt64() uint64
ReadFloat32() float32
ReadFloat64() float64
ReadInt16LE() int16
ReadInt32LE() int32
ReadInt64LE() int64
ReadUInt16LE() uint16
ReadUInt32LE() uint32
ReadUInt64LE() uint64
ReadFloat32LE() float32
ReadFloat64LE() float64
}
ByteBuf defines a byte buffer interface that is NOT concurrent-safe.
Notes: - Unless specified otherwise, out-of-bound or invalid operations will panic (preserving the original semantics). - Bytes returns a mutable view; writing to the returned slice will mutate the internal buffer. - Use BytesCopy to obtain an immutable copy if you need isolation from internal mutations.
func EmptyByteBuf ¶
func EmptyByteBuf() ByteBuf
func NewByteBuf ¶
func NewByteBufString ¶
type DefaultByteBuf ¶
type DefaultByteBuf struct {
// contains filtered or unexported fields
}
func (*DefaultByteBuf) AppendByte ¶ added in v1.1.0
func (b *DefaultByteBuf) AppendByte(c byte) ByteBuf
AppendByte appends a single byte and returns the ByteBuf for chaining (renamed from WriteByte)
func (*DefaultByteBuf) Bytes ¶
func (b *DefaultByteBuf) Bytes() []byte
func (*DefaultByteBuf) BytesCopy ¶
func (b *DefaultByteBuf) BytesCopy() []byte
func (*DefaultByteBuf) Cap ¶
func (b *DefaultByteBuf) Cap() int
func (*DefaultByteBuf) Clone ¶
func (b *DefaultByteBuf) Clone() ByteBuf
func (*DefaultByteBuf) Close ¶
func (b *DefaultByteBuf) Close() error
func (*DefaultByteBuf) Compact ¶
func (b *DefaultByteBuf) Compact() ByteBuf
Compact moves the readable region to the beginning of the buffer and adjusts indices (including marked indices).
func (*DefaultByteBuf) EnsureCapacity ¶
func (b *DefaultByteBuf) EnsureCapacity(n int) ByteBuf
EnsureCapacity guarantees that at least n bytes of writable space are available. It first tries to compact; if still insufficient, it grows using the existing doubling policy and compacts again.
func (*DefaultByteBuf) Grow ¶
func (b *DefaultByteBuf) Grow(v int) ByteBuf
func (*DefaultByteBuf) MarkReaderIndex ¶
func (b *DefaultByteBuf) MarkReaderIndex() ByteBuf
func (*DefaultByteBuf) MarkWriterIndex ¶
func (b *DefaultByteBuf) MarkWriterIndex() ByteBuf
func (*DefaultByteBuf) MustReadByte ¶ added in v1.1.0
func (b *DefaultByteBuf) MustReadByte() byte
MustReadByte reads a single byte and panics if insufficient data (original ReadByte behavior)
func (*DefaultByteBuf) ReadByte ¶
func (b *DefaultByteBuf) ReadByte() (byte, error)
ReadByte implements io.ByteReader interface with error return
func (*DefaultByteBuf) ReadByteBuf ¶
func (b *DefaultByteBuf) ReadByteBuf(len int) ByteBuf
func (*DefaultByteBuf) ReadBytes ¶
func (b *DefaultByteBuf) ReadBytes(len int) []byte
func (*DefaultByteBuf) ReadFloat32 ¶
func (b *DefaultByteBuf) ReadFloat32() float32
func (*DefaultByteBuf) ReadFloat32LE ¶
func (b *DefaultByteBuf) ReadFloat32LE() float32
func (*DefaultByteBuf) ReadFloat64 ¶
func (b *DefaultByteBuf) ReadFloat64() float64
func (*DefaultByteBuf) ReadFloat64LE ¶
func (b *DefaultByteBuf) ReadFloat64LE() float64
func (*DefaultByteBuf) ReadInt16 ¶
func (b *DefaultByteBuf) ReadInt16() int16
func (*DefaultByteBuf) ReadInt16LE ¶
func (b *DefaultByteBuf) ReadInt16LE() int16
func (*DefaultByteBuf) ReadInt32 ¶
func (b *DefaultByteBuf) ReadInt32() int32
func (*DefaultByteBuf) ReadInt32LE ¶
func (b *DefaultByteBuf) ReadInt32LE() int32
func (*DefaultByteBuf) ReadInt64 ¶
func (b *DefaultByteBuf) ReadInt64() int64
func (*DefaultByteBuf) ReadInt64LE ¶
func (b *DefaultByteBuf) ReadInt64LE() int64
func (*DefaultByteBuf) ReadUInt16 ¶
func (b *DefaultByteBuf) ReadUInt16() uint16
func (*DefaultByteBuf) ReadUInt16LE ¶
func (b *DefaultByteBuf) ReadUInt16LE() uint16
func (*DefaultByteBuf) ReadUInt32 ¶
func (b *DefaultByteBuf) ReadUInt32() uint32
func (*DefaultByteBuf) ReadUInt32LE ¶
func (b *DefaultByteBuf) ReadUInt32LE() uint32
func (*DefaultByteBuf) ReadUInt64 ¶
func (b *DefaultByteBuf) ReadUInt64() uint64
func (*DefaultByteBuf) ReadUInt64LE ¶
func (b *DefaultByteBuf) ReadUInt64LE() uint64
func (*DefaultByteBuf) ReadWriter ¶
func (b *DefaultByteBuf) ReadWriter(writer io.Writer) ByteBuf
func (*DefaultByteBuf) ReadableBytes ¶
func (b *DefaultByteBuf) ReadableBytes() int
func (*DefaultByteBuf) ReaderIndex ¶
func (b *DefaultByteBuf) ReaderIndex() int
func (*DefaultByteBuf) Reset ¶
func (b *DefaultByteBuf) Reset() ByteBuf
func (*DefaultByteBuf) ResetReaderIndex ¶
func (b *DefaultByteBuf) ResetReaderIndex() ByteBuf
func (*DefaultByteBuf) ResetWriterIndex ¶
func (b *DefaultByteBuf) ResetWriterIndex() ByteBuf
func (*DefaultByteBuf) Skip ¶
func (b *DefaultByteBuf) Skip(v int) ByteBuf
func (*DefaultByteBuf) WriteAt ¶
func (b *DefaultByteBuf) WriteAt(p []byte, offset int64) (n int, err error)
func (*DefaultByteBuf) WriteByte ¶
func (b *DefaultByteBuf) WriteByte(c byte) error
WriteByte implements io.ByteWriter interface with error return
func (*DefaultByteBuf) WriteByteBuf ¶
func (b *DefaultByteBuf) WriteByteBuf(buf ByteBuf) ByteBuf
func (*DefaultByteBuf) WriteBytes ¶
func (b *DefaultByteBuf) WriteBytes(bs []byte) ByteBuf
func (*DefaultByteBuf) WriteFloat32 ¶
func (b *DefaultByteBuf) WriteFloat32(v float32) ByteBuf
func (*DefaultByteBuf) WriteFloat32LE ¶
func (b *DefaultByteBuf) WriteFloat32LE(v float32) ByteBuf
func (*DefaultByteBuf) WriteFloat64 ¶
func (b *DefaultByteBuf) WriteFloat64(v float64) ByteBuf
func (*DefaultByteBuf) WriteFloat64LE ¶
func (b *DefaultByteBuf) WriteFloat64LE(v float64) ByteBuf
func (*DefaultByteBuf) WriteInt16 ¶
func (b *DefaultByteBuf) WriteInt16(v int16) ByteBuf
func (*DefaultByteBuf) WriteInt16LE ¶
func (b *DefaultByteBuf) WriteInt16LE(v int16) ByteBuf
func (*DefaultByteBuf) WriteInt32 ¶
func (b *DefaultByteBuf) WriteInt32(v int32) ByteBuf
func (*DefaultByteBuf) WriteInt32LE ¶
func (b *DefaultByteBuf) WriteInt32LE(v int32) ByteBuf
func (*DefaultByteBuf) WriteInt64 ¶
func (b *DefaultByteBuf) WriteInt64(v int64) ByteBuf
func (*DefaultByteBuf) WriteInt64LE ¶
func (b *DefaultByteBuf) WriteInt64LE(v int64) ByteBuf
func (*DefaultByteBuf) WriteReader ¶
func (b *DefaultByteBuf) WriteReader(reader io.Reader) ByteBuf
func (*DefaultByteBuf) WriteString ¶
func (b *DefaultByteBuf) WriteString(s string) ByteBuf
func (*DefaultByteBuf) WriteUInt16 ¶
func (b *DefaultByteBuf) WriteUInt16(v uint16) ByteBuf
func (*DefaultByteBuf) WriteUInt16LE ¶
func (b *DefaultByteBuf) WriteUInt16LE(v uint16) ByteBuf
func (*DefaultByteBuf) WriteUInt32 ¶
func (b *DefaultByteBuf) WriteUInt32(v uint32) ByteBuf
func (*DefaultByteBuf) WriteUInt32LE ¶
func (b *DefaultByteBuf) WriteUInt32LE(v uint32) ByteBuf
func (*DefaultByteBuf) WriteUInt64 ¶
func (b *DefaultByteBuf) WriteUInt64(v uint64) ByteBuf
func (*DefaultByteBuf) WriteUInt64LE ¶
func (b *DefaultByteBuf) WriteUInt64LE(v uint64) ByteBuf
func (*DefaultByteBuf) WriterIndex ¶
func (b *DefaultByteBuf) WriterIndex() int