Class DecompressingEntity
- java.lang.Object
-
- org.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
- org.apache.hc.client5.http.entity.compress.DecompressingEntity
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.hc.core5.http.EntityDetails,org.apache.hc.core5.http.HttpEntity
public class DecompressingEntity extends org.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDecompressingEntity.LazyDecompressingInputStream
-
Constructor Summary
Constructors Constructor Description DecompressingEntity(org.apache.hc.core5.http.HttpEntity src, org.apache.hc.core5.io.IOFunction<java.io.InputStream,java.io.InputStream> decoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamgetContent()Returns the cached decoded stream, creating it once if necessary.java.lang.StringgetContentEncoding()Content is no longer encodedlonggetContentLength()Length is unknown after decompression.private java.io.InputStreamgetDecompressingStream()voidwriteTo(java.io.OutputStream out)Streams the decoded bytes directly toout.
-
-
-
Field Detail
-
BUF_SIZE
private static final int BUF_SIZE
- See Also:
- Constant Field Values
-
decoder
private final org.apache.hc.core5.io.IOFunction<java.io.InputStream,java.io.InputStream> decoder
-
cached
private volatile java.io.InputStream cached
-
-
Method Detail
-
getDecompressingStream
private java.io.InputStream getDecompressingStream() throws java.io.IOException- Throws:
java.io.IOException
-
getContent
public java.io.InputStream getContent() throws java.io.IOExceptionReturns the cached decoded stream, creating it once if necessary.- Specified by:
getContentin interfaceorg.apache.hc.core5.http.HttpEntity- Overrides:
getContentin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
getContentLength
public long getContentLength()
Length is unknown after decompression.- Specified by:
getContentLengthin interfaceorg.apache.hc.core5.http.EntityDetails- Overrides:
getContentLengthin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
getContentEncoding
public java.lang.String getContentEncoding()
Content is no longer encoded- Specified by:
getContentEncodingin interfaceorg.apache.hc.core5.http.EntityDetails- Overrides:
getContentEncodingin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOExceptionStreams the decoded bytes directly toout.- Specified by:
writeToin interfaceorg.apache.hc.core5.http.HttpEntity- Overrides:
writeToin classorg.apache.hc.core5.http.io.entity.HttpEntityWrapper- Throws:
java.io.IOException
-
-