Class DeflatingGzipEntityProducer
- java.lang.Object
-
- org.apache.hc.client5.http.async.methods.DeflatingGzipEntityProducer
-
- All Implemented Interfaces:
org.apache.hc.core5.http.EntityDetails,org.apache.hc.core5.http.nio.AsyncDataProducer,org.apache.hc.core5.http.nio.AsyncEntityProducer,org.apache.hc.core5.http.nio.ResourceHolder
public final class DeflatingGzipEntityProducer extends java.lang.Object implements org.apache.hc.core5.http.nio.AsyncEntityProducerStreams anAsyncEntityProducerthrough raw DEFLATE and wraps the result in a valid GZIP container.Memory usage is bounded (8 KiB buffers) and back-pressure from the I/O reactor is honoured.
- Since:
- 5.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classDeflatingGzipEntityProducer.InnerChannel
-
Field Summary
Fields Modifier and Type Field Description private java.util.zip.CRC32crcprivate java.util.zip.Deflaterdeflaterprivate org.apache.hc.core5.http.nio.AsyncEntityProducerdelegateprivate booleanfinishedprivate booleanheaderSentprivate byte[]inprivate static intIN_BUFprivate static intOUT_BUFprivate java.nio.ByteBufferoutBufprivate java.util.concurrent.atomic.AtomicBooleanreleasedprivate longuncompressed
-
Constructor Summary
Constructors Constructor Description DeflatingGzipEntityProducer(org.apache.hc.core5.http.nio.AsyncEntityProducer delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()private voiddeflateToOut()voidfailed(java.lang.Exception cause)private voidflushOut(org.apache.hc.core5.http.nio.DataStreamChannel chan)java.lang.StringgetContentEncoding()longgetContentLength()java.lang.StringgetContentType()java.util.Set<java.lang.String>getTrailerNames()booleanisChunked()booleanisRepeatable()voidproduce(org.apache.hc.core5.http.nio.DataStreamChannel chan)voidreleaseResources()
-
-
-
Field Detail
-
IN_BUF
private static final int IN_BUF
- See Also:
- Constant Field Values
-
OUT_BUF
private static final int OUT_BUF
- See Also:
- Constant Field Values
-
delegate
private final org.apache.hc.core5.http.nio.AsyncEntityProducer delegate
-
crc
private final java.util.zip.CRC32 crc
-
deflater
private final java.util.zip.Deflater deflater
-
in
private final byte[] in
-
outBuf
private final java.nio.ByteBuffer outBuf
-
headerSent
private boolean headerSent
-
finished
private boolean finished
-
uncompressed
private long uncompressed
-
released
private final java.util.concurrent.atomic.AtomicBoolean released
-
-
Method Detail
-
isRepeatable
public boolean isRepeatable()
- Specified by:
isRepeatablein interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
getContentLength
public long getContentLength()
- Specified by:
getContentLengthin interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
public java.lang.String getContentEncoding()
- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails
-
isChunked
public boolean isChunked()
- Specified by:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
public java.util.Set<java.lang.String> getTrailerNames()
- Specified by:
getTrailerNamesin interfaceorg.apache.hc.core5.http.EntityDetails
-
available
public int available()
- Specified by:
availablein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
public void produce(org.apache.hc.core5.http.nio.DataStreamChannel chan) throws java.io.IOException- Specified by:
producein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer- Throws:
java.io.IOException
-
deflateToOut
private void deflateToOut()
-
flushOut
private void flushOut(org.apache.hc.core5.http.nio.DataStreamChannel chan) throws java.io.IOException- Throws:
java.io.IOException
-
failed
public void failed(java.lang.Exception cause)
- Specified by:
failedin interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
releaseResources
public void releaseResources()
- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
-