public void release(InputStream inputStream) throws IOException {
    // for non-seekable input stream, close and return
    if (!(inputStream instanceof CachedSeekableInputStream) || !CACHE_ENABLED) {
      inputStream.close();
      return;
    }

    synchronized (mFileIdToInputStreamIds) {
      if (!mFileIdToInputStreamIds
          .containsKey(((CachedSeekableInputStream) inputStream).getFileId())) {
        LOG.debug("The resource {} is already expired",
            ((CachedSeekableInputStream) inputStream).getResourceId());
        // the cache no longer tracks this input stream
        inputStream.close();
        return;
      }
      UfsInputStreamIdSet resources =
          mFileIdToInputStreamIds.get(((CachedSeekableInputStream) inputStream).getFileId());
      if (!resources.release(((CachedSeekableInputStream) inputStream).getResourceId())) {
        LOG.debug("Close the expired input stream resource of {}",
            ((CachedSeekableInputStream) inputStream).getResourceId());
        // the input stream expired, close it
        inputStream.close();
      }
    }
  }
public void release ( InputStream inputStream ) throws IOException { if ( ! ( inputStream instanceof CachedSeekableInputStream ) || ! CACHE_ENABLED ) { inputStream . close ( ) ; return ; } synchronized ( mFileIdToInputStreamIds ) { if ( ! mFileIdToInputStreamIds . containsKey ( ( ( CachedSeekableInputStream ) inputStream ) . getFileId ( ) ) ) { LOG . debug ( "The resource {} is already expired" , ( ( CachedSeekableInputStream ) inputStream ) . getResourceId ( ) ) ; inputStream . close ( ) ; return ; } UfsInputStreamIdSet resources = mFileIdToInputStreamIds . get ( ( ( CachedSeekableInputStream ) inputStream ) . getFileId ( ) ) ; if ( ! resources . release ( ( ( CachedSeekableInputStream ) inputStream ) . getResourceId ( ) ) ) { LOG . debug ( "Close the expired input stream resource of {}" , ( ( CachedSeekableInputStream ) inputStream ) . getResourceId ( ) ) ; inputStream . close ( ) ; } } }
Releases an input stream. The input stream is closed if it's already expired.

@param inputStream the input stream to release
@throws IOException when input stream fails to close