public synchronized void close() throws IOException {
    if (cache != null) {
      if (cacheState > 0) {
        if (cacheState == 1) {
          cacheState = 2;
          if (cache.release(this))  // return true if in the cache, otherwise was opened regular, so must be closed regular
            return;
          cacheState = 0; // release failed, bail out
        } else {
          return; // close has been called more than once - ok
        }
      }
    }

    if (debugLeaks) {
      openFiles.remove(location);
      if (showOpen) System.out.println("  close " + location);
    }

    if (file == null)
      return;

    // If we are writing and the buffer has been modified, flush the contents of the buffer.
    flush();

    // may need to extend file, in case no fill is being used
    // may need to truncate file in case overwriting a longer file
    // use only if minLength is set (by N3iosp)
    long fileSize = file.length();
    if (!readonly && (minLength != 0) && (minLength != fileSize)) {
      file.setLength(minLength);
      // System.out.println("TRUNCATE!!! minlength="+minLength);
    }

    // Close the underlying file object.
    file.close();
    file = null;  // help the gc
  }
public synchronized void close() throws IOException {
    if (cache != null) {
      if (cacheState > 0) {
        if (cacheState == 1) {
          cacheState = 2;
          if (cache.release(this))  
            return;
          cacheState = 0; 
        } else {
          return; 
        }
      }
    }

    if (debugLeaks) {
      openFiles.remove(location);
      if (showOpen) System.out.println("  close " + location);
    }

    if (file == null)
      return;

    
    flush();

    
    
    
    long fileSize = file.length();
    if (!readonly && (minLength != 0) && (minLength != fileSize)) {
      file.setLength(minLength);
      
    }

    
    file.close();
    file = null;  
  }
public synchronized void close ( ) throws IOException { if ( cache != null ) { if ( cacheState > 0 ) { if ( cacheState == 1 ) { cacheState = 2 ; if ( cache . release ( this ) ) // return true if in the cache, otherwise was opened regular, so must be closed regular
 return ; cacheState = 0 ; // release failed, bail out
 } else { return ; // close has been called more than once - ok
 } } } if ( debugLeaks ) { openFiles . remove ( location ) ; if ( showOpen ) System . out . println ( "  close " + location ) ; } if ( file == null ) return ; // If we are writing and the buffer has been modified, flush the contents of the buffer.
 flush ( ) ; // may need to extend file, in case no fill is being used
 // may need to truncate file in case overwriting a longer file
 // use only if minLength is set (by N3iosp)
 long fileSize = file . length ( ) ; if ( ! readonly && ( minLength != 0 ) && ( minLength != fileSize ) ) { file . setLength ( minLength ) ; // System.out.println("TRUNCATE!!! minlength="+minLength);
 } // Close the underlying file object.
 file . close ( ) ; file = null ; // help the gc
 }
Close the file, and release any associated system resources.

@throws IOException if an I/O error occurrs.
Close the file and release any associated system resources .