|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface HttpEntity
An entity that can be sent or received with an HTTP message.
Entities can be found in some
requests and in
responses, where they are optional.
In some places, the JavaDoc distinguishes three kinds of entities,
depending on where their content originates:
connection.
Streamed entities are generally not
repeatable.
repeatable.
| Method Summary | |
|---|---|
void |
consumeContent()
TODO: The name of this method is misnomer. |
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(OutputStream outstream)
Writes the entity content to the output stream. |
| Method Detail |
|---|
boolean isRepeatable()
boolean isChunked()
true if chunked encoding is preferred for this
entity, or false if it is notlong getContentLength()
Long.MAX_VALUE,
a negative number is returned.Header getContentType()
null if the content type is unknownHeader getContentEncoding()
null if the content encoding is unknown
InputStream getContent()
throws IOException,
IllegalStateException
repeatable
will throw an exception if this method is called multiple times.
IOException - if the stream could not be created
IllegalStateException - if this entity is not repeatable and the stream
has already been obtained previously
void writeTo(OutputStream outstream)
throws IOException
outstream - the output stream to write entity content to
IOException - if an I/O error occursboolean isStreaming()
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.
true if the entity content is streamed and
not yet consumed, false otherwise
void consumeContent()
throws IOException
connection. The entity
needs to be consumed completely in order to re-use the connection
with keep-alive.
IOException - if an I/O error occurs.
This indicates that connection keep-alive is not possible.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||