public ByteBuffer put ( byte [ ] src , int off , int len ) { int length = src . length ; if ( off < 0 || len < 0 || off + len > length ) { throw new IndexOutOfBoundsException ( ) ; } if ( len > remaining ( ) ) { throw new BufferOverflowException ( ) ; } for ( int i = 0 ; i < len ; i ++ ) { byteArray . set ( i + position , src [ off + i ] ) ; } position += len ; return this ; }
Writes bytes in the given byte array starting from the specified offset to the current position and increases the position by the number of bytes written .