Tr : System.arraycopy(...) equivalents for ByteBuffer/FileChannel

Alan Bateman Alan.Bateman at oracle.com
Sat Oct 13 02:46:39 PDT 2012


On 12/10/2012 22:57, Jeff Hain wrote:
> >ByteBuffers (...) were not designed for concurrent access
>
>
> Not in general, but with readable HeapByteBuffers you can use
> array()/arrayOffset() and play around with the byte array,
> regardless of ByteBuffer's position (and even limit), so it
> wouldn't be too much of an heresy to allow for other
> position-agnostic treatments.
For buffers that are backed by byte arrays in the heap then you can of 
course do things on the underlying byte array.

Buffers were designed with specific use-cases in mind but they don't 
cover all use-cases. There are cases (and I suspect your usage comes 
into this category) where folks need a container that is backed by a 
byte[] or memory outside of the heap and but without the position/limit 
that are used for I/O operations. I think we will need to examine this 
at some point, perhaps by introducing something like a raw 
buffer/container. That might be a more appropriate time to examine an 
absolute bulk get/put.

-Alan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20121013/5f756345/attachment.html 


More information about the nio-dev mailing list