codec

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int16ToBytes added in v1.6.1

func Int16ToBytes(i uint16) []byte

func IntToByteBigEndian

func IntToByteBigEndian(i int) []byte

func ReadBytes

func ReadBytes(reader io.Reader, size int) ([]byte, error)

func ReadInt

func ReadInt(reader io.Reader) (int, error)

Types

type ByteBuf

type ByteBuf struct {
	// contains filtered or unexported fields
}

ByteBuf 字节缓冲区

func NewReadByteBuf

func NewReadByteBuf(reader io.Reader) *ByteBuf

func NewReadWriteByteBuf

func NewReadWriteByteBuf(reader io.Reader, writer io.Writer) *ByteBuf

func NewWriteByteBuf

func NewWriteByteBuf(writer io.Writer) *ByteBuf

func (*ByteBuf) Flush

func (b *ByteBuf) Flush() error

func (*ByteBuf) Read

func (b *ByteBuf) Read(p []byte) (n int, err error)

func (*ByteBuf) ReadAll added in v1.6.1

func (b *ByteBuf) ReadAll() ([]byte, error)

func (*ByteBuf) ReadBuffer

func (b *ByteBuf) ReadBuffer() *bufio.Reader

func (*ByteBuf) ReadByte

func (b *ByteBuf) ReadByte() (byte, error)

func (*ByteBuf) ReadBytes

func (b *ByteBuf) ReadBytes(size int) ([]byte, error)

func (*ByteBuf) ReadFrom added in v1.2.0

func (b *ByteBuf) ReadFrom(reader io.Reader) (int64, error)

func (*ByteBuf) ReadInt

func (b *ByteBuf) ReadInt() (int, error)

func (*ByteBuf) ReadLine

func (b *ByteBuf) ReadLine() (string, error)

func (*ByteBuf) Write

func (b *ByteBuf) Write(p []byte) (n int, err error)

func (*ByteBuf) WriteBuffer

func (b *ByteBuf) WriteBuffer() *bufio.Writer

func (*ByteBuf) WriteByte

func (b *ByteBuf) WriteByte(data byte) error

func (*ByteBuf) WriteBytes

func (b *ByteBuf) WriteBytes(data []byte) error

func (*ByteBuf) WriteInt

func (b *ByteBuf) WriteInt(data int) error

func (*ByteBuf) WriteString

func (b *ByteBuf) WriteString(data string) error

func (*ByteBuf) WriteTo added in v1.2.0

func (b *ByteBuf) WriteTo(write io.Writer) (int64, error)

type LengthBased

type LengthBased struct {
	// contains filtered or unexported fields
}

LengthBased 长度解码器, 重试从缓冲区解析数据帧程度

func NewLengthBased

func NewLengthBased(lengthFieldOffset int, lengthFieldLength int, lengthAdjustment int, initialBytesToStrip int) *LengthBased

func (*LengthBased) Decode

func (l *LengthBased) Decode(reader *bufio.Reader) (*bufio.Reader, error)

Decode 长度解码器

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL