> Hello,
>
[quoted text clipped - 7 lines]
> directly allocated buffers can potentially be mapped to native buffers and
> whatnot, but still...it's a bit of a hassle.
If the pain is already suffered then I don't see why you want to change
the code. On the other hand, if you are just anticipating the pain and
hassle then I would recommend instead writing straightforward code and
worrying only if it ends up not meeting your performance requirements.
Out of curiosity, however, what makes direct ByteBuffers so much more
trouble than others?

Signature
John Bollinger
jobollin@indiana.edu
Remon van Vliet - 01 Jun 2005 13:52 GMT
Well, the thing is, direct buffers do not have a backing array
(byte[]). So, when i use small direct buffers for reads and writes, at
some point i have to put the contents of the direct buffer into a
larger bytebuffer (one that represents the entire packet i am trying to
send). The catch is that i may need to put the first half of the direct
buffer in one larger buffer (for example, if it's the end few bytes of
the previous packet) and put the rest in a new buffer. And there is
no(?) way to put a specific part (offset + length) of bytebuffer A in
bytebuffer B.
If there is an incorrect assumption in my reasoning let me know ;)
> > Hello,
> >
[quoted text clipped - 15 lines]
> Out of curiosity, however, what makes direct ByteBuffers so much more
> trouble than others?