code: public static byte[] loadBytes(long offset, int length, RandomAccessFile raf)
  			throws IOException {
  		if (length < 0) {
  			length = 0;
  			logger.error("Negative length: " + length);
  		}
  		if (offset < 0) {
  			offset = 0;
  			logger.error("Negative offset: " + offset);
  		}
  		// stay within file bounds
  		offset = Math.min(offset, raf.length());
  		long endOffset = Math.min(offset + length, raf.length());
  		length = (int) (endOffset - offset);
  		raf.seek(offset);
  		byte[] bytes = new byte[length];
  		raf.readFully(bytes);
  		return bytes;
  	}
docs: Loads the bytes at the offset into a byte array with the given length
  using the raf.
  
  @param offset
  to seek
  @param length
  of the byte array, equals number of bytes read
  @param raf
  the random access file
  @return byte array
  @throws IOException
  if unable to read the bytes