code: private void setLength(long newLength) throws IOException {
      // Set new file length (considered metadata) and sync it to storage.
      raf.setLength(newLength);
      raf.getChannel().force(true);
    }
docs: Sets the length of the file.