Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NewCodecFuncMap map[CodecType]NewCodecFunc
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { io.Closer ReadHeader(*Header) error ReadBody(interface{}) error Write(*Header, interface{}) error }
编解码器接口
func NewGobCodec ¶
func NewGobCodec(conn io.ReadWriteCloser) Codec
type CodecType ¶
type CodecType string
const ( // gob 和 json 都是 go 语言自带的序列化方式 GobType CodecType = "application/gob" )
type GobCodec ¶
type GobCodec struct {
// contains filtered or unexported fields
}
func (*GobCodec) ReadHeader ¶
type NewCodecFunc ¶
type NewCodecFunc func(io.ReadWriteCloser) Codec
编解码器的构造函数 将 IO 包起来,读/写都通过编解码器 codec 完成
Click to show internal directories.
Click to hide internal directories.