Documentation ¶
Index ¶
- Variables
- type Decoder
- func (d *Decoder) Decode() (gap.MsgPacket, error)
- func (d Decoder) DecodeBuff(buff *bytes.Buffer) (gap.MsgPacket, error)
- func (d Decoder) DecodeBytes(data []byte) (gap.MsgPacket, error)
- func (d *Decoder) ReadFrom(r io.Reader) (int64, error)
- func (d *Decoder) Reset()
- func (d *Decoder) Write(p []byte) (int, error)
- type Encoder
- func (e *Encoder) Encode(src string, seq int64, msg gap.MsgReader) error
- func (e Encoder) EncodeBuff(buff *bytes.Buffer, src string, seq int64, msg gap.MsgReader) error
- func (e Encoder) EncodeBytes(src string, seq int64, msg gap.MsgReader) (binaryutil.RecycleBytes, error)
- func (e Encoder) EncodeWriter(writer io.Writer, src string, seq int64, msg gap.MsgReader) error
- func (e *Encoder) Read(p []byte) (int, error)
- func (e *Encoder) Reset()
- func (e *Encoder) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDataNotEnough = io.ErrShortBuffer // 数据不足
)
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { MsgCreator gap.IMsgCreator // 消息对象构建器 // contains filtered or unexported fields }
Decoder 消息包解码器
func (Decoder) DecodeBuff ¶
DecodeBuff 从指定buff,解码消息包
func (Decoder) DecodeBytes ¶
DecodeBytes 从指定bytes,解码消息包
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder 消息包编码器
func (Encoder) EncodeBuff ¶
EncodeBuff 编码消息包,写入指定buffer
func (Encoder) EncodeBytes ¶
func (e Encoder) EncodeBytes(src string, seq int64, msg gap.MsgReader) (binaryutil.RecycleBytes, error)
EncodeBytes 编码消息包,返回可回收bytes
func (Encoder) EncodeWriter ¶
EncodeWriter 编码消息包,写入指定writer
Click to show internal directories.
Click to hide internal directories.