예제 #1
0
파일: packet.go 프로젝트: houcy/link
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,
	}
}