On Wed, 21 May 2008 10:42:30 +0900, Emmanuel Lecharny
<[EMAIL PROTECTED]> wrote:
이희승 (Trustin Lee) wrote:
On Wed, 21 May 2008 10:08:27 +0900, Emmanuel Lecharny
<[EMAIL PROTECTED]> wrote:
Another things would also be to get a byte[] getBytes( in length )
method returning as much bytes as possible, up to a length. If the
number of available bytes is below the length, the returned byte array
will only contains the available bytes, and it will be up to the
decoder to deal with it. The idea is to avoid calling the element()
method for every single byte we want.
It sounds similar to ByteBufferQueue.pollSlice(int length), but
pollSlice() returns null when there's not enough data.
Would be better to returns what has already been read. Sometime, you are
just proxying the data, and you want to send it to the next consumer as
soon as you get some. Otherwise, the queue will buffer potentially
gigantic data in memory. (This is something we experimented with
JpegPhoto data in Ldap, this is the reason I mention it).
We already have ByteBufferQueue.poll() if it's just for consuming as soon
as possible? Are you suggesting something else?
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/