public final class CompressingEntity extends HttpEntityWrapper
HttpEntity on write.
The actual compressor is supplied as an IOFunction<OutputStream,OutputStream>
and is resolved by the caller (for example via reflective factories). This keeps
compression back-ends fully optional and avoids hard classpath dependencies.
The entity reports the configured Content-Encoding token and streams
the content; length is unknown (-1), and the entity is chunked.
| Constructor and Description |
|---|
CompressingEntity(HttpEntity src,
String coding,
IOFunction<OutputStream,OutputStream> encoder) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getContent() |
String |
getContentEncoding() |
long |
getContentLength() |
boolean |
isChunked() |
void |
writeTo(OutputStream out) |
close, getContentType, getTrailerNames, getTrailers, isRepeatable, isStreaming, toStringpublic CompressingEntity(HttpEntity src, String coding, IOFunction<OutputStream,OutputStream> encoder)
public String getContentEncoding()
getContentEncoding in interface EntityDetailsgetContentEncoding in class HttpEntityWrapperpublic long getContentLength()
getContentLength in interface EntityDetailsgetContentLength in class HttpEntityWrapperpublic boolean isChunked()
isChunked in interface EntityDetailsisChunked in class HttpEntityWrapperpublic InputStream getContent()
getContent in interface HttpEntitygetContent in class HttpEntityWrapperpublic void writeTo(OutputStream out) throws IOException
writeTo in interface HttpEntitywriteTo in class HttpEntityWrapperIOExceptionCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.