/** * Closes the access to all currently opened resources such as file input streams and all * resources of this children directly owned by this reader. Its primary use is to allow the * garbage collector to perform a vanilla job. * * <p>This method should be called only if it is for sure that this object instance will never be * used again. The results of referencing an instance of this class after a call to <code>close() * </code> are undefined. * * <p>Overrides of this method should always call <code>super.close();</code> after disposing this * instance. * * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { if (bandInputStreams == null) { return; } for (ImageInputStream imageInputStream : bandInputStreams.values()) { (imageInputStream).close(); } bandInputStreams.clear(); bandInputStreams = null; if (readerExtenders != null) { readerExtenders.clear(); readerExtenders = null; } super.close(); }
@Override public synchronized void close() throws IOException { super.close(); inputStream.close(); }