All Methods Instance Methods Concrete Methods Modifier and Type Method Description
getContent()Returns a content stream of the entity.
getContentLength()Tells the length of the content, if known.
isRepeatable()Tells if the entity is capable of producing its data more than once.
isStreaming()Tells whether this entity depends on an underlying stream.
writeTo(OutputStream outstream)Writes the entity content out to the output stream.
Methods inherited from class org.apache.http.entity.AbstractHttpEntity
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
public EntityTemplate(ContentProducer contentproducer)
public long getContentLength()Tells the length of the content, if known.
- the number of bytes of the content, or
a negative number if unknown. If the content length is known
Long.MAX_VALUE, a negative number is returned.
public InputStream getContent() throws IOExceptionReturns a content stream of the entity.
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 the
InputStream.close()method is invoked.
public boolean isRepeatable()Tells if the entity is capable of producing its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not.
- true if the entity is repeatable, false otherwise.
public void writeTo(OutputStream outstream) throws IOExceptionWrites the entity content out to the output stream.
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
IOException- if an I/O error occurs
public boolean isStreaming()Tells whether this entity depends on an underlying stream. Streamed entities that read data directly from the socket should return
true. Self-contained entities should return
false. Wrapping entities should delegate this call to the wrapped entity.
trueif the entity content is streamed,