you can using flip and compact method for this:
ByteBuffer buffer = ByteBuffer.allocate(1024*1024);
int end = 0;
while (end >= 0 || buffer.hasRemaining( )) {
if (end != -1) end = inChannel.read(buffer);
buffer.flip( );
...
buffer.compact( );
}
Am 28.12.2010 13:21, schrieb Supun Kamburugamuva:
> I would like to reuse the ByteBuffer that is allocated for a request.
> Is it possible to clear the buffer after the decoder/encoder completed
> and use the same buffer for another request? I'm using HTTPCore-NIO.
>
> Thanks,
> Supun...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>