Beispiel #1
0
func (codecType packetCodecType) NewEncoder(w io.Writer) link.Encoder {
	pw := binary.NewPacketWriter(codecType.Spliter, w)
	return &packetEncoder{
		Writer: pw,
		Base:   codecType.Base.NewEncoder(pw),
	}
}
Beispiel #2
0
func (codecType packetCodecType) NewCodec(r io.Reader, w io.Writer) Codec {
	pr := binary.NewPacketReader(codecType.Spliter, r)
	pw := binary.NewPacketWriter(codecType.Spliter, w)
	return &packetCodec{
		Codec:  codecType.CodecType.NewCodec(pr, pw),
		Writer: pw,
	}
}