|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.entity.HttpEntityWrapper
Base class for wrapping entities.
Keeps a wrappedEntity
and delegates all
calls to it. Implementations of wrapping entities can derive
from this class and need to override only those methods that
should not be delegated to the wrapped entity.
Field Summary | |
protected HttpEntity |
wrappedEntity
The wrapped entity. |
Constructor Summary | |
HttpEntityWrapper(HttpEntity wrapped)
Creates a new entity wrapper. |
Method Summary | |
void |
consumeContent()
Consumes the remaining content of a streamed entity. |
java.io.InputStream |
getContent()
Creates a new InputStream object of the entity. |
Header |
getContentEncoding()
Obtains the Content-Encoding header, if known. |
long |
getContentLength()
Tells the length of the content, if known. |
Header |
getContentType()
Obtains the Content-Type header, if known. |
boolean |
isChunked()
Tells about chunked encoding for this entity. |
boolean |
isRepeatable()
Tells if the entity is capable to produce its data more than once. |
boolean |
isStreaming()
Tells whether this entity depends on an underlying stream. |
void |
writeTo(java.io.OutputStream outstream)
Writes the entity content to the output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected HttpEntity wrappedEntity
Constructor Detail |
public HttpEntityWrapper(HttpEntity wrapped)
wrapped
- the entity to wrapMethod Detail |
public boolean isRepeatable()
HttpEntity
isRepeatable
in interface HttpEntity
public boolean isChunked()
HttpEntity
isChunked
in interface HttpEntity
true
if chunked encoding is preferred for this
entity, or false
if it is notpublic long getContentLength()
HttpEntity
getContentLength
in interface HttpEntity
Long.MAX_VALUE
,
a negative number is returned.public Header getContentType()
HttpEntity
getContentType
in interface HttpEntity
null
if the content type is unknownpublic Header getContentEncoding()
HttpEntity
getContentEncoding
in interface HttpEntity
null
if the content encoding is unknownpublic java.io.InputStream getContent() throws java.io.IOException
HttpEntity
repeatable
will throw an exception if this method is called multiple times.
getContent
in interface HttpEntity
java.io.IOException
- if the stream could not be createdpublic void writeTo(java.io.OutputStream outstream) throws java.io.IOException
HttpEntity
writeTo
in interface HttpEntity
outstream
- the output stream to write entity content to
java.io.IOException
- if an I/O error occurspublic boolean isStreaming()
HttpEntity
true
until the
content has been consumed, false
afterwards.
Self-contained entities should return false
.
Wrapping entities should delegate this call to the wrapped entity.
getContent
has been read to EOF,
or after consumeContent
has been called.
If a streamed entity can not detect whether the stream has been
read to EOF, it should return true
until
consumeContent
is called.
isStreaming
in interface HttpEntity
true
if the entity content is streamed and
not yet consumed, false
otherwisepublic void consumeContent() throws java.io.IOException
HttpEntity
connection
. The entity
needs to be consumed completely in order to re-use the connection
with keep-alive.
consumeContent
in interface HttpEntity
java.io.IOException
- if an I/O error occurs.
This indicates that connection keep-alive is not possible.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |