Le 9/10/12 5:37 PM, Ed O'Loughlin a écrit :
On 10 September 2012 15:15, Emmanuel Lécharny elecharny-at-gmail.com |
users@mina.apache.org| <mhrdmwq...@sneakemail.com> wrote:

Le 9/10/12 3:19 PM, Mina a écrit :

  Hi,
I'm using IoBuffer#array to process an IoBuffer's data but I find that I
must also call its get() method so it knows I've read all its data. Is
there a quicker way of notifying it that I'm done with it?

You can clear it when you are done, or set it's position to its limit.

But the question is : why would you do that ? Is there any good reason ?

To reduce the number of times I'm copying data around.

You can always move the current position in the buffer, and re-read the data.


Keep in mind that a ByteBuffer has a position, a limit and a size, plus you can mark the current position and return to this mark.

In other words, I do think you already have pretty much everything you need if you want to avoid copying the data.

Just see the ByteBuffer documentation, IoBuffer is just a wrapper around this class (for some reason, Sun decided that a ByteBuffer can't be overloaded)

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to