Top Description Fields Constructors Methods
org.apache.http.client.entity

public Class GzipCompressingEntity

extends HttpEntityWrapper
Class Inheritance
Imports
java.io.IOException, .InputStream, .OutputStream, java.util.zip.GZIPOutputStream, org.apache.http.Header, .HttpEntity, org.apache.http.entity.HttpEntityWrapper, org.apache.http.message.BasicHeader, org.apache.http.protocol.HTTP, org.apache.http.util.Args

Wrapping entity that compresses content when writing.
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final String
Inherited from org.apache.http.entity.HttpEntityWrapper:
wrappedEntity

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InputStream
getContent()

Overrides org.apache.http.entity.HttpEntityWrapper.getContent.

Implements org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity.
public Header
public long
public boolean
isChunked()

Overrides org.apache.http.entity.HttpEntityWrapper.isChunked.

Implements org.apache.http.HttpEntity.isChunked.

Tells about chunked encoding for this entity.
public void
writeTo(final OutputStream
the output stream to write entity content to
outStream
)

Overrides org.apache.http.entity.HttpEntityWrapper.writeTo.

Implements org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.
Inherited from org.apache.http.entity.HttpEntityWrapper:
consumeContentgetContentTypeisRepeatableisStreaming

Field Detail

GZIP_CODECback to summary
private static final String GZIP_CODEC

Constructor Detail

GzipCompressingEntityback to summary
public GzipCompressingEntity(final HttpEntity entity)

Method Detail

getContentback to summary
public InputStream getContent() throws IOException

Overrides org.apache.http.entity.HttpEntityWrapper.getContent.

Implements org.apache.http.HttpEntity.getContent.

Doc from org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity. Repeatable entities are expected to create a new instance of InputStream for each invocation of this method and therefore can be consumed multiple times. Entities that are not repeatable are expected to return the same InputStream instance and therefore may not be consumed more than once.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated after the InputStream#close() method is invoked.

Returns:InputStream

content stream of the entity.

Annotations
@Override
Exceptions
IOException:
if the stream could not be created
getContentEncodingback to summary
public Header getContentEncoding()

Overrides org.apache.http.entity.HttpEntityWrapper.getContentEncoding.

Implements org.apache.http.HttpEntity.getContentEncoding.

Doc from org.apache.http.HttpEntity.getContentEncoding.

Obtains the Content-Encoding header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity. Wrapping entities that modify the content encoding should adjust this header accordingly.

Returns:Header

the Content-Encoding header for this entity, or null if the content encoding is unknown

Annotations
@Override
getContentLengthback to summary
public long getContentLength()

Overrides org.apache.http.entity.HttpEntityWrapper.getContentLength.

Implements org.apache.http.HttpEntity.getContentLength.

Doc from org.apache.http.HttpEntity.getContentLength.

Tells the length of the content, if known.

Returns:long

the number of bytes of the content, or a negative number if unknown. If the content length is known but exceeds Long.MAX_VALUE, a negative number is returned.

Annotations
@Override
isChunkedback to summary
public boolean isChunked()

Overrides org.apache.http.entity.HttpEntityWrapper.isChunked.

Implements org.apache.http.HttpEntity.isChunked.

Doc from org.apache.http.HttpEntity.isChunked.

Tells about chunked encoding for this entity. The primary purpose of this method is to indicate whether chunked encoding should be used when the entity is sent. For entities that are received, it can also indicate whether the entity was received with chunked encoding.

The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.

Returns:boolean

true if chunked encoding is preferred for this entity, or false if it is not

Annotations
@Override
writeToback to summary
public void writeTo(final OutputStream outStream) throws IOException

Overrides org.apache.http.entity.HttpEntityWrapper.writeTo.

Implements org.apache.http.HttpEntity.writeTo.

Doc from org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.

Parameters
outStream:OutputStream

the output stream to write entity content to

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs