public interface HttpEntity
responses, where they are optional.
There are three distinct types of entities in HttpCore,
depending on where their
Streamedentities are generally not
|Modifier and Type||Method and Description|
Returns a content stream of the entity.
Obtains the Content-Encoding header, if known.
Tells the length of the content, if known.
Obtains the Content-Type header, if known.
Tells about chunked encoding for this entity.
Tells if the entity is capable of producing its data more than once.
Tells whether this entity depends on an underlying stream.
Writes the entity content out to the output stream.
The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.
trueif chunked encoding is preferred for this entity, or
falseif it is not
Long.MAX_VALUE, a negative number is returned.
nullif the content type is unknown
nullif the content encoding is unknown
java.io.InputStream getContent() throws java.io.IOException, java.lang.UnsupportedOperationException
Repeatableentities are expected to create a new instance of
InputStreamfor each invocation of this method and therefore can be consumed multiple times. Entities that are not
repeatableare expected to return the same
InputStreaminstance 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
InputStream.close() method is invoked.
java.io.IOException- if the stream could not be created
java.lang.UnsupportedOperationException- if entity content cannot be represented as
void writeTo(java.io.OutputStream outstream) throws java.io.IOException
IMPORTANT: Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.
outstream- the output stream to write entity content to
java.io.IOException- if an I/O error occurs
true. Self-contained entities should return
false. Wrapping entities should delegate this call to the wrapped entity.
trueif the entity content is streamed,
@Deprecated void consumeContent() throws java.io.IOException
InputStream.close()on the input stream returned by
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
java.io.IOException- if an I/O error occurs.
Copyright © 2010 - 2019 Adobe. All Rights Reserved