/** * Set the memory buffer to null and call dispose on the reader as well. */ public void dispose() { synchronized ( LOCK ) { if ( data != null ) { data = null; } if ( reader != null ) { reader.dispose(); } } }
/** * Causes the cachefile to be written (if existing) and the memory buffers to be set to null. * * @param memoryBuffersAsWell * if true the memorybuffers (the ones which don't have rasterfiles to back them up) will be deleted as * well. * * @return the amount of freed memory. */ public long dispose( boolean memoryBuffersAsWell ) { if ( cachedReader != null ) { // close the file in the reader as well. cachedReader.dispose(); super.dispose(); } long result = 0; if ( gridWriter != null ) { result = writeCache( true ); } else { if ( memoryBuffersAsWell ) { clear( false ); } } return result; }