Hi,
I have a strange situation(imho) with ByteBuffer of MINA. What i try to do is, check the buffer until "\r\n" is available; and then get the string representation of this much of bytes:
byte b = 0;
int counter = 3;
boolean hasR = true;
String mes = null;
while (in.hasRemaining()) {
b = in.get();
counter++;
if (b == '\r')
hasR = true;
if ((hasR) && (b == '\n')) {
break;
}
}
in.flip();
System.out.println("after 1. flip:"+in.remaining());
in.remaining() returns the total data that is read until the flip. but i know that there are more bytes in the Buffer that are not read. I guess this is a normal behavior for MINA but how can make those bytes after \r\n available after the flip() command is called?
Maybe i miss a very simple point???
thanks in advance.
Best regards..
- ByteBuffer behavior Cinar Eren
- Re: ByteBuffer behavior Maarten Bosteels
- Re: ByteBuffer behavior Niklas Therning
