code: @Override
      public void setLength(long length) throws ReadOnlyException, IOException {
          checkWritable();
          
          if (getLength() == length) return;
          
          updateTimeStamps(true);
          chain.setSize(length);
          
          this.entry.setStartCluster(chain.getStartCluster());
          this.entry.setLength(length);
      }
docs: Sets the size (in bytes) of this file. Because
  {@link #write(long, java.nio.ByteBuffer) writing} to the file will grow
  it automatically if needed, this method is mainly usefull for truncating
  a file.
  
  @param length the new length of the file in bytes
  @throws ReadOnlyException if this file is read-only
  @throws IOException on error updating the file size