Class DeflatingAsyncEntityProducer
java.lang.Object
org.apache.hc.client5.http.async.methods.DeflatingAsyncEntityProducer
- 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 DeflatingAsyncEntityProducer
extends Object
implements org.apache.hc.core5.http.nio.AsyncEntityProducer
AsyncEntityProducer that streams the output of another producer
through the raw DEFLATE compression algorithm.
The delegate’s bytes are read in small chunks, compressed with
Deflater and written immediately to the HTTP I/O
layer. Memory use is therefore bounded even for very large request
entities.
- Since:
- 5.6
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Deflaterprivate final org.apache.hc.core5.http.nio.AsyncEntityProducerprivate final AtomicBooleanprivate booleanprivate final byte[]private static final intinbound copy‐bufferprivate static final intoutbound staging bufferprivate final ByteBufferholds compressed bytes not yet sent downstream -
Constructor Summary
ConstructorsConstructorDescriptionDeflatingAsyncEntityProducer(org.apache.hc.core5.http.nio.AsyncEntityProducer delegate) -
Method Summary
Modifier and TypeMethodDescriptionintprivate voidvoidprivate booleanflushPending(org.apache.hc.core5.http.nio.DataStreamChannel ch) copy as much as possible frompendingto the wirelongbooleanbooleanvoidproduce(org.apache.hc.core5.http.nio.DataStreamChannel channel) void
-
Field Details
-
IN_BUF
private static final int IN_BUFinbound copy‐buffer- See Also:
-
OUT_BUF
private static final int OUT_BUFoutbound staging buffer- See Also:
-
delegate
private final org.apache.hc.core5.http.nio.AsyncEntityProducer delegate -
contentType
-
deflater
-
pending
holds compressed bytes not yet sent downstream -
in
private final byte[] in -
delegateEnded
-
finished
private boolean finished
-
-
Constructor Details
-
DeflatingAsyncEntityProducer
public DeflatingAsyncEntityProducer(org.apache.hc.core5.http.nio.AsyncEntityProducer delegate)
-
-
Method Details
-
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
- Specified by:
getContentTypein interfaceorg.apache.hc.core5.http.EntityDetails
-
getContentEncoding
- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails
-
isChunked
public boolean isChunked()- Specified by:
isChunkedin interfaceorg.apache.hc.core5.http.EntityDetails
-
getTrailerNames
-
available
public int available()- Specified by:
availablein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
- Specified by:
producein interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer- Throws:
IOException
-
flushPending
copy as much as possible frompendingto the wire- Throws:
IOException
-
deflateToPending
-
failed
- Specified by:
failedin interfaceorg.apache.hc.core5.http.nio.AsyncEntityProducer
-
releaseResources
public void releaseResources()- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-