not an answer to the question but you might want to check what happens
when buffer contains "xxx\rxxx\nxx"

MINA already has a decoder for reading lines of text

Maarten


On 5/31/06, Cinar Eren <[EMAIL PROTECTED]> wrote:

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..

Reply via email to