users@grizzly.java.net

Re: org.glassfish.grizzly.Buffer.get(i) != org.glassfish.grizzly.Buffer.toByteBuffer().get(i)

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Thu, 27 Nov 2014 09:01:38 -0800

Hi,

yes, it's normal.
Grizzly Buffer may wrap a ByteBuffer with a specific offset or just a
part of ByteBuffer (view), which you have to consider.
Normally when you do toByteBuffer() - the returned ByteBuffer's position
and limit will represent current Grizzly Buffer's view.

WBR,
Alexey.

On 27.11.14 08:12, Евгений Бушуев wrote:
> Hi!
>
> Is it legal for a org.glassfish.grizzly.Buffer
> (org.glassfish.grizzly.memory.HeapMemoryManager.TrimmableHeapBuffer#TrimmableHeapBuffer)
> to return ByteBuffer from its toByteBuffer method so that ByteBuffer's
> content won't be same as in original grizzly.Buffer?
>
> Can't figure out why this happens, seems to be random.
> The grizzly.Buffer instance is not composite.
>
> Best regards, Eugene.