Пример #1
0
func (codecType packetCodecType) NewDecoder(r io.Reader) link.Decoder {
	return &packetDecoder{
		Base: codecType.Base.NewDecoder(
			binary.NewPacketReader(codecType.Spliter, r),
		),
	}
}
Пример #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,
	}
}