codec

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltInCodec

type BuiltInCodec struct {
}

func (*BuiltInCodec) Decode

func (cc *BuiltInCodec) Decode(c core.CodecConn) ([]byte, error)

Decode ...

func (*BuiltInCodec) Encode

func (cc *BuiltInCodec) Encode(_ core.CodecConn, buf []byte) (_ []byte, _ error)

Encode ...

type ConnHelper

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

ConnHelper Codec 连接帮助

func (*ConnHelper) BufferLength

func (conn *ConnHelper) BufferLength() (size int)

BufferLength 读取容器数据长度

func (*ConnHelper) InitBuffer

func (conn *ConnHelper) InitBuffer()

InitBuffer 初始化 buffer

func (*ConnHelper) PushPacket

func (conn *ConnHelper) PushPacket(b []byte)

PushPacket 把网络包压入 buffer

func (*ConnHelper) Read

func (conn *ConnHelper) Read() (buf []byte)

Read 读取所有数据,不移动读指针

func (*ConnHelper) ReadN

func (conn *ConnHelper) ReadN(n int) (size int, buf []byte)

ReadN 读取给定长度的数据,如果数据不够,则返回所有数据,不移动读指针

func (*ConnHelper) ResetBuffer

func (conn *ConnHelper) ResetBuffer()

ResetBuffer 重置读取容器

func (*ConnHelper) ShiftN

func (conn *ConnHelper) ShiftN(n int) (size int)

ShiftN 移动读指针到给定长度

type LengthFieldBasedFrameCodec

type LengthFieldBasedFrameCodec struct {
}

func (*LengthFieldBasedFrameCodec) Decode

func (cc *LengthFieldBasedFrameCodec) Decode(c core.CodecConn) ([]byte, error)

Decode ...

func (*LengthFieldBasedFrameCodec) Encode

func (cc *LengthFieldBasedFrameCodec) Encode(_ core.CodecConn, buf []byte) (out []byte, err error)

Encode ...

Jump to

Keyboard shortcuts

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