There is no guarantee that you will receive all of it with one read operation.
You will need to account for it in your decoder and that is exactly what ByteToMessageDecoder is for. Please check the javadocs of it for more details. > On 4. Jul 2017, at 11:39, James Kim <[email protected]> wrote: > > i made a camel netty4 server program.and client sent 1119 byte message but > myu decoder truncated by 1024/95 > > here is my code. > > @ChannelHandler.Sharable > public static class BytesDecoder extends MessageToMessageDecoder<ByteBuf> > { > @Override > protected void decode(ChannelHandlerContext ctx, ByteBuf msg, > List<Object> out) throws Exception { > // it may be empty, then return null > System.out.println("BytesDecoder > readableBytes:"+msg.readableBytes()); > if (msg.isReadable()) { > // ByteBuf may not expose array method for accessing the > under layer bytes > byte[] bytes = new byte[msg.readableBytes()]; > int readerIndex = msg.readerIndex(); > msg.getBytes(readerIndex, bytes); > out.add(bytes); > } > } > } > > result > BytesDecoder readableBytes:1024 > BytesDecoder readableBytes:95 > > i want to get a full message byte 1119 byte. > > > > -- > You received this message because you are subscribed to the Google Groups > "Netty discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/netty/7060c6b2-f193-4da9-a788-7c31269c8d94%40googlegroups.com > > <https://groups.google.com/d/msgid/netty/7060c6b2-f193-4da9-a788-7c31269c8d94%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Netty discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/E97DC1BC-2F8F-434E-A66A-10605793674E%40googlemail.com. For more options, visit https://groups.google.com/d/optout.
