java.lang.Object
org.apache.http.entity.HttpEntityWrapper
org.apache.http.entity.BufferedHttpEntity
- All Implemented Interfaces:
- org.apache.http.HttpEntity
- public class BufferedHttpEntity
- extends HttpEntityWrapper
A wrapping entity that buffers it content if necessary.
The buffered entity is always repeatable.
If the wrapped entity is repeatable itself, calls are passed through.
If the wrapped entity is not repeatable, the content is read into a
buffer once and provided from there as often as required.
- Since:
- 4.0
- Version:
- $Revision: 385308 $
|
Field Summary |
private byte[] |
buffer
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buffer
private final byte[] buffer
BufferedHttpEntity
public BufferedHttpEntity(org.apache.http.HttpEntity entity)
throws java.io.IOException
getContentLength
public long getContentLength()
- Description copied from interface:
org.apache.http.HttpEntity
- Tells the length of the content, if known.
- Specified by:
getContentLength in interface org.apache.http.HttpEntity- Overrides:
getContentLength in class HttpEntityWrapper
getContent
public java.io.InputStream getContent()
throws java.io.IOException
- Description copied from interface:
org.apache.http.HttpEntity
- Creates a new InputStream object of the entity.
It is a programming error
to return the same InputStream object more than once.
Entities that are not repeatable 55
will throw an exception if this method is called multiple times.
- Specified by:
getContent in interface org.apache.http.HttpEntity- Overrides:
getContent in class HttpEntityWrapper
isChunked
public boolean isChunked()
- Tells that this entity does not have to be chunked.
- Specified by:
isChunked in interface org.apache.http.HttpEntity- Overrides:
isChunked in class HttpEntityWrapper
isRepeatable
public boolean isRepeatable()
- Tells that this entity is repeatable.
- Specified by:
isRepeatable in interface org.apache.http.HttpEntity- Overrides:
isRepeatable in class HttpEntityWrapper
writeTo
public void writeTo(java.io.OutputStream outstream)
throws java.io.IOException
- Description copied from interface:
org.apache.http.HttpEntity
- Writes the entity content to the output stream.
- Specified by:
writeTo in interface org.apache.http.HttpEntity- Overrides:
writeTo in class HttpEntityWrapper
isStreaming
public boolean isStreaming()
- Description copied from interface:
org.apache.http.HttpEntity
- Tells whether this entity depends on an underlying stream.
Streamed entities should return
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.
The content of a streamed entity is consumed when the stream
returned by getContent 55 has been read to EOF,
or after consumeContent 55 has been called.
If a streamed entity can not detect whether the stream has been
read to EOF, it should return true until
consumeContent 55 is called.
- Specified by:
isStreaming in interface org.apache.http.HttpEntity- Overrides:
isStreaming in class HttpEntityWrapper