private void adjustBackingFileLength(byte[] buffer,long index) throws IOException {
  if (buffer == null || buffer.length == 0) {
    throw new IOException("Buffer null or empty!");
  }
  long newsize=fHeader.headerSize() + (index * CHUNK_ENC_SIZE) + CHUNK_IV_SIZE+ buffer.length+ CHUNK_TLEN;
  if (newsize > realLength()) {
    backingRandomAccessFile.setLength(newsize);
  }
}

private void adjustBackingFileLength ( byte [ ] buffer , long index ) throws IOException { if ( buffer == null || buffer . length == 0 ) { throw new IOException ( "Buffer null or empty!" ) ; } long newsize = fHeader . headerSize ( ) + ( index * CHUNK_ENC_SIZE ) + CHUNK_IV_SIZE + buffer . length + CHUNK_TLEN ; if ( newsize > realLength ( ) ) { backingRandomAccessFile . setLength ( newsize ) ; } }
helper methods which adjusts the actual length of the backing file for caching . as with caching , data is only actually written to disk , if a chunk has been filled completely and a new chunk is being accessed , the file size has to be extended in advance in order for methods like seek / skipbytes / . . . to still be able to work .
