class EntityEnclosingRequestWrapper.EntityWrapper extends HttpEntityWrapper
wrappedEntity
Constructor and Description |
---|
EntityEnclosingRequestWrapper.EntityWrapper(HttpEntity entity) |
Modifier and Type | Method and Description |
---|---|
void |
consumeContent()
This method is deprecated since version 4.1.
|
java.io.InputStream |
getContent()
Returns a content stream of the entity.
|
void |
writeTo(java.io.OutputStream outstream)
Writes the entity content out to the output stream.
|
getContentEncoding, getContentLength, getContentType, isChunked, isRepeatable, isStreaming
EntityEnclosingRequestWrapper.EntityWrapper(HttpEntity entity)
public void consumeContent() throws java.io.IOException
HttpEntity
InputStream.close()
on the input stream returned by
HttpEntity.getContent()
This method is called to indicate that the content of this entity is no longer required. All entity implementations are expected to release all allocated resources as a result of this method invocation. Content streaming entities are also expected to dispose of the remaining content, if any. Wrapping entities should delegate this call to the wrapped entity.
This method is of particular importance for entities being
received from a connection
. The entity
needs to be consumed completely in order to re-use the connection
with keep-alive.
consumeContent
in interface HttpEntity
consumeContent
in class HttpEntityWrapper
java.io.IOException
- if an I/O error occurs.and #writeTo(OutputStream)
public java.io.InputStream getContent() throws java.io.IOException
HttpEntity
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: Please note all entity implementations must ensure that
all allocated resources are properly deallocated after
the InputStream.close()
method is invoked.
getContent
in interface HttpEntity
getContent
in class HttpEntityWrapper
java.io.IOException
- if the stream could not be createdHttpEntity.isRepeatable()
public void writeTo(java.io.OutputStream outstream) throws java.io.IOException
HttpEntity
IMPORTANT: Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.
writeTo
in interface HttpEntity
writeTo
in class HttpEntityWrapper
outstream
- the output stream to write entity content tojava.io.IOException
- if an I/O error occurs