code: private void adjustRequest(GetObjectRequest req) {
          long[] range = req.getRange();
          long lastByte = range[1];
          long totalBytesToDownload = lastByte - this.origStartingByte + 1;
  
          if (dstfile.exists()) {
              if (!FileLocks.lock(dstfile)) {
                  throw new FileLockException("Fail to lock " + dstfile
                                              + " for range adjustment");
              }
              try {
                  expectedFileLength = dstfile.length();
                  long startingByte = this.origStartingByte + expectedFileLength;
                  LOG.info("Adjusting request range from " + Arrays.toString(range)
                           + " to "
                           + Arrays.toString(new long[] {startingByte, lastByte})
                           + " for file " + dstfile);
                  req.setRange(startingByte, lastByte);
                  totalBytesToDownload = lastByte - startingByte + 1;
              } finally {
                  FileLocks.unlock(dstfile);
              }
          }
  
          if (totalBytesToDownload < 0) {
              throw new IllegalArgumentException(
                  "Unable to determine the range for download operation. lastByte="
                  + lastByte + ", origStartingByte=" + origStartingByte
                  + ", expectedFileLength=" + expectedFileLength
                  + ", totalBytesToDownload=" + totalBytesToDownload);
          }
      }
docs: This method is called only if it is a resumed download.
  
  Adjust the range of the get request, and the expected (ie current) file
  length of the destination file to append to.