예제 #1
0
  /** Ensure close (especially flush) when we're finished with. */
  @Override
  public void finalize() throws Throwable {
    super.finalize();

    if (closedExplicitly) return;

    if (DEBUG) {
      LOG.info("finalize() for not explicitly closed stream");
    }

    // FIXME: I got a bunch of NPEs when I didn't check for nulls here...HOW?!
    if (descriptor != null && descriptor.isOpen()) {
      // tidy up
      finish(autoclose);
    }
  }
예제 #2
0
 /**
  * Internal close.
  *
  * @throws IOException
  * @throws BadDescriptorException
  */
 private void close() throws IOException, BadDescriptorException {
   // finish and close ourselves
   finish(true);
 }