public interface HttpEntity
HttpRequest
or
HttpResponse
.
There are three distinct types of entities, depending on their content:
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Provides the entity's content as bytes.
|
InputStream |
getContent()
Provides the entity's content as a stream.
|
Optional<Long> |
getLength()
Provides the length (in bytes) of the
HttpEntity , if known. |
Collection<HttpPart> |
getParts()
Provides the entity's content parts.
|
boolean |
isComposed()
Tells whether or not this entity is composed of several parts, in which case they should be available through
getParts() . |
boolean |
isStreaming()
Tells whether this entity's content is stream based.
|
boolean isStreaming()
true
if content is streamed, false
otherwisegetContent()
boolean isComposed()
getParts()
.true
if there are several content parts, false
otherwiseInputStream getContent()
InputStream
representing this entity's content or null
if such representation is not possiblebyte[] getBytes() throws IOException
null
if such representation is not possibleIOException
- if an error occurs creating the byte arrayCollection<HttpPart> getParts() throws IOException
HttpParts
representing this entity's content parts, if presentIOException
- if an error occurs handling the partsisComposed()
Optional<Long> getLength()
HttpEntity
, if known. For the most part, only received entities from HTTP
messages that carried a 'Content-Length' header will return a length.Optional
with the length (in bytes) or an empty one if unknownCopyright © 2018. All rights reserved.