What's the most efficient way to put as many bytes as possible from a ByteBuffer bbuf_src
into another ByteBuffer bbuf_dest
(as well as know how many bytes were transferred)? I'm trying bbuf_dest.put(bbuf_src)
but it seems to want to throw a BufferOverflowException and I can't get the javadocs from Sun right now (network problems) when I need them. >:( argh.
edit: darnit, @Richard's approach (use put() from the backing array of bbuf_src
) won't work if bbuf_src is a ReadOnly buffer, as you can't get access to that array. What can I do in that case???