[jcifs] NIO: java.nio.ByteBuffer Question

Michael B Allen mba2000 at ioplex.com
Mon Dec 13 04:25:14 GMT 2004

Would anyone happen to know how java.nio handles the following scenario?

I read data from a SocketChannel into a ByteBuffer. Let's say that for
whatever reason the read fills the ByteBuffer to capacity. Now the buffer
has 1 whole message plus 10 bytes of another entirely different unrelated
message. I have no problem decoding the first message but then I'm left
with 10 bytes at the end of the ByteBuffer with no room to read the
remainder of the current message. Is there some way to move those bytes to
the beginning so I can read from the channel again and start decoding the
next message?

How is this scenario supposed to be handled with NIO?

What are your general impressions of NIO? I have read vague claims that it
has bugs.


More information about the jcifs mailing list