|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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()
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. |
| Method Detail |
public boolean isRepeatable()
public boolean isChunked()
true if chunked encoding is preferred for this
entity, or false if it is notpublic long getContentLength()
Long.MAX_VALUE,
a negative number is returned.public Header getContentType()
null if the content type is unknownpublic Header getContentEncoding()
null if the content encoding is unknown
public java.io.InputStream getContent()
throws java.io.IOException,
java.lang.IllegalStateException
repeatable
will throw an exception if this method is called multiple times.
java.io.IOException - if the stream could not be created
java.lang.IllegalStateException - if this entity is not repeatable and the stream
has already been obtained previously
public void writeTo(java.io.OutputStream outstream)
throws java.io.IOException
outstream - the output stream to write entity content to
java.io.IOException - if an I/O error occurspublic boolean 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
public void consumeContent()
throws java.io.IOException
connection. The entity
needs to be consumed completely in order to re-use the connection
with keep-alive.
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 | ||||||||||