@Override public ProtocolDecoder getDecoder(IoSession is) throws Exception { return new CumulativeProtocolDecoder() { protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { if (in.remaining() > 0) { byte[] buf = new byte[in.remaining()]; in.get(buf); out.write(new String(buf, "US-ASCII")); return true; } else { return false; } } }; }
public ProtocolDecoder getDecoder() throws Exception { return new CumulativeProtocolDecoder() { protected boolean doDecode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception { if (in.remaining() > 0) { byte[] buf = new byte[in.remaining()]; in.get(buf); out.write(new String(buf, "US-ASCII")); return true; } else { return false; } } }; }