io/src/main/java/com/stanfy/enroscar/io/PoolableBufferedInputStream.java
@Override
  public synchronized int available() throws IOException {
    final InputStream localIn = in; // 'in' could be invalidated by close()
    if (buf == null || localIn == null) { throw new IOException("Stream is closed"); }
    return count - pos + localIn.available();
  }
@Override
  public synchronized int available() throws IOException {
    final InputStream localIn = in; // 'in' could be invalidated by close()
    if (buf == null || localIn == null) { throw new IOException("Stream is closed"); }
    return count - pos + localIn.available();
  }
Returns the number of bytes that are available before this stream will
block. This method returns the number of bytes available in the buffer
plus those available in the source stream.

@return the number of bytes available before blocking.
@throws IOException
if this stream is closed.