Class InflatingGzipDataConsumer

java.lang.Object
org.apache.hc.client5.http.async.methods.InflatingGzipDataConsumer
All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer, org.apache.hc.core5.http.nio.ResourceHolder

public final class InflatingGzipDataConsumer extends Object implements org.apache.hc.core5.http.nio.AsyncDataConsumer
Streaming AsyncDataConsumer that inflates Content-Encoding: gzip. It parses the GZIP header on the fly, passes the deflated body through a Inflater and verifies CRC + length trailer.

The implementation is fully non-blocking and honours back-pressure.

Since:
5.6
  • Field Details

    • OUT

      private static final int OUT
      See Also:
    • downstream

      private final org.apache.hc.core5.http.nio.AsyncDataConsumer downstream
    • inflater

      private final Inflater inflater
    • crc

      private final CRC32 crc
    • out

      private final byte[] out
    • headerBuf

      private final ByteArrayOutputStream headerBuf
    • headerDone

      private boolean headerDone
    • closed

      private final AtomicBoolean closed
  • Constructor Details

    • InflatingGzipDataConsumer

      public InflatingGzipDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream)
  • Method Details

    • updateCapacity

      public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c) throws IOException
      Specified by:
      updateCapacity in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      IOException
    • consume

      public void consume(ByteBuffer src) throws IOException
      Specified by:
      consume in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      IOException
    • streamEnd

      public void streamEnd(List<? extends org.apache.hc.core5.http.Header> trailers) throws org.apache.hc.core5.http.HttpException, IOException
      Specified by:
      streamEnd in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      org.apache.hc.core5.http.HttpException
      IOException
    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder