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 java.lang.Object implements org.apache.hc.core5.http.nio.AsyncDataConsumerStreamingAsyncDataConsumerthat inflatesContent-Encoding: gzip. It parses the GZIP header on the fly, passes the deflated body through aInflaterand verifies CRC + length trailer.The implementation is fully non-blocking and honours back-pressure.
- Since:
- 5.6
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanclosedprivate java.util.zip.CRC32crcprivate org.apache.hc.core5.http.nio.AsyncDataConsumerdownstreamprivate java.io.ByteArrayOutputStreamheaderBufprivate booleanheaderDoneprivate java.util.zip.Inflaterinflaterprivate byte[]outprivate static intOUT
-
Constructor Summary
Constructors Constructor Description InflatingGzipDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume(java.nio.ByteBuffer src)voidreleaseResources()voidstreamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers)voidupdateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c)
-
-
-
Field Detail
-
OUT
private static final int OUT
- See Also:
- Constant Field Values
-
downstream
private final org.apache.hc.core5.http.nio.AsyncDataConsumer downstream
-
inflater
private final java.util.zip.Inflater inflater
-
crc
private final java.util.zip.CRC32 crc
-
out
private final byte[] out
-
headerBuf
private final java.io.ByteArrayOutputStream headerBuf
-
headerDone
private boolean headerDone
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
-
Method Detail
-
updateCapacity
public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c) throws java.io.IOException- Specified by:
updateCapacityin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
java.io.IOException
-
consume
public void consume(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
consumein interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
java.io.IOException
-
streamEnd
public void streamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers) throws org.apache.hc.core5.http.HttpException, java.io.IOException- Specified by:
streamEndin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
org.apache.hc.core5.http.HttpExceptionjava.io.IOException
-
releaseResources
public void releaseResources()
- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
-