public void copyTo ( int srcOffset , byte [ ] destArray , int destOffset , int size ) { int cursor = destOffset ; for ( ByteBuffer bb : toDirectByteBuffers ( srcOffset , size ) ) { int bbSize = bb . remaining ( ) ; if ( ( cursor + bbSize ) > destArray . length ) throw new ArrayIndexOutOfBoundsException ( String . format ( "cursor + bbSize = %,d" , cursor + bbSize ) ) ; bb . get ( destArray , cursor , bbSize ) ; cursor += bbSize ; } }
Copy the contents of this buffer begginning from the srcOffset to a destination byte array