class DeflateUncompressor implements Uncompressor {

  @Override
  public void uncompress(InputStream compressedIn, OutputStream uncompressedOut)
      throws IOException {
    InflaterInputStream inflaterIn =
        new InflaterInputStream(compressedIn, createOrResetInflater(), inputBufferSize);
    byte[] buffer = new byte[outputBufferSize];
    int numRead = 0;
    while ((numRead = inflaterIn.read(buffer)) >= 0) {
      uncompressedOut.write(buffer, 0, numRead);
    }
    if (!isCaching()) {
      release();
    }
  }

}