Java - ByteBuffer.remaining() problems?

When you are done putting bytes into the buffer, you should flip it. You can probably do this in place of your first call to 'rewind' instead.

When you are done putting bytes into the buffer, you should flip it. You can probably do this in place of your first call to 'rewind' instead. A java.nio.

Buffer distinguishes between 'capacity' and 'limit'. If you don't flip it, then limit and capacity are the same as the length of the array with which you initialized it. By flipping it, the limit will be set to the end of the data you've encoded, capacity will still be 1024.

ByteBuffer#remaining looks at the delta between position and limit.

Thanks, Joe. That fixed it. – feroze Nov 15 '09 at 8:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions