question: public void write ( byte [ ] b , int off , int len , long pos ) throws IOException { if ( b == null ) { throw new NullPointerException ( "b == null!" ) ; } if ( ( off < 0 ) || ( len < 0 ) || ( pos < 0 ) || ( off + len > b . length ) || ( off + len < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } long lastPos = pos + len - 1 ; if ( lastPos >= length ) { pad ( lastPos ) ; length = lastPos + 1 ; } int offset = ( int ) ( pos % BUFFER_LENGTH ) ; while ( len > 0 ) { byte [ ] buf = getCacheBlock ( pos / BUFFER_LENGTH ) ; int nbytes = Math . min ( len , BUFFER_LENGTH - offset ) ; System . arraycopy ( b , off , buf , offset , nbytes ) ; pos += nbytes ; off += nbytes ; len -= nbytes ; offset = 0 ; } }
target:  Overwrites and/or appends the cache from a byte array. The length of the cache will be extended as needed to hold the incoming data.