Ejemplo n.º 1
0
Archivo: packet.go Proyecto: houcy/link
func (codecType packetCodecType) NewDecoder(r io.Reader) link.Decoder {
	return &packetDecoder{
		Base: codecType.Base.NewDecoder(
			binary.NewPacketReader(codecType.Spliter, r),
		),
	}
}
Ejemplo n.º 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,
	}
}