code: public static void dumpLocationToFile(PhysicalLocation loc, File inFile,
  			File outFile) throws IOException {
  		Preconditions.checkArgument(!outFile.exists());
  		Preconditions.checkArgument(inFile.exists(), inFile.isFile());
  
  		final int BUFFER_SIZE = 2048;
  
  		try (RandomAccessFile raf = new RandomAccessFile(inFile, "r");
  				FileOutputStream out = new FileOutputStream(outFile)) {
  			byte[] buffer;
  			long remainingBytes = loc.size();
  			long offset = loc.from();
  			while (remainingBytes >= BUFFER_SIZE) {
  				buffer = loadBytesSafely(offset, BUFFER_SIZE, raf);
  				out.write(buffer);
  				remainingBytes -= BUFFER_SIZE;
  				offset += BUFFER_SIZE;
  			}
  
  			if (remainingBytes > 0) {
  				buffer = loadBytesSafely(offset, (int) remainingBytes, raf);
  				out.write(buffer);
  			}
  		}
  	}
docs: Dumps the given part of the inFile to outFile. The part to dump is
  represented by loc. This will read safely from inFile which means
  locations outside of inFile are written as zero bytes to outFile.
  
  outFile must not exist yet.
  inFile must exist and must not be a directory.
  
  @param loc
  @param file
  @throws IOException