Class IncomingHttpEntity
- All Implemented Interfaces:
Closeable, AutoCloseable, EntityDetails, HttpEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InputStreamprivate final longprivate final HttpMessage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Gets a content stream of the entity.Gets content encoding of this entity, if known.longGets length of this entity, if known.Gets content type of this entity, if known.Gets the preliminary declaration of trailing headers.Gets supplier of message trailers - headers sent after message body.booleanTests the chunked transfer hint for this entity.booleanTests if the entity is capable of producing its data more than once.booleanTests whether this entity depends on an underlying stream.toString()voidwriteTo(OutputStream outStream) Writes the entity content out to the output stream.
-
Field Details
-
-
len
private final long len -
message
-
-
Constructor Details
-
IncomingHttpEntity
-
-
Method Details
-
isRepeatable
public boolean isRepeatable()Description copied from interface:HttpEntityTests 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.- Specified by:
isRepeatablein interfaceHttpEntity- Returns:
- true if the entity is repeatable, false otherwise.
-
isChunked
public boolean isChunked()Description copied from interface:EntityDetailsTests the chunked transfer hint for this entity.The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.
- Specified by:
isChunkedin interfaceEntityDetails- Returns:
- the chunked transfer hint for this entity.
-
getContentLength
public long getContentLength()Description copied from interface:EntityDetailsGets length of this entity, if known.- Specified by:
getContentLengthin interfaceEntityDetails- Returns:
- the length of this entity, may be
0.
-
getContentType
Description copied from interface:EntityDetailsGets content type of this entity, if known.- Specified by:
getContentTypein interfaceEntityDetails- Returns:
- the content type of this entity, may be
null.
-
getContentEncoding
Description copied from interface:EntityDetailsGets content encoding of this entity, if known.- Specified by:
getContentEncodingin interfaceEntityDetails- Returns:
- the content encoding of this entity, may be
null.
-
getContent
Description copied from interface:HttpEntityGets a content stream of the entity.Repeatableentities are expected to create a new instance ofInputStreamfor each invocation of this method and therefore can be consumed multiple times. Entities that are notrepeatableare expected to return the sameInputStreaminstance and therefore may not be consumed more than once.If this entity belongs to an incoming HTTP message, calling
InputStream.close()on the returnedInputStreamwill try to consume the complete entity content to keep the connection alive. In cases where this is undesired, e.g. when only a small part of the content is relevant and consuming the complete entity content would be too inefficient, only the HTTP message from which this entity was obtained should be closed (if supported).IMPORTANT: Please note all entity implementations must ensure that all allocated resources are properly deallocated after the
InputStream.close()method is invoked.- Specified by:
getContentin interfaceHttpEntity- Returns:
- content stream of the entity.
- Throws:
IOException- if the stream could not be createdIllegalStateException- See Also:
-
isStreaming
public boolean isStreaming()Description copied from interface:HttpEntityTests whether this entity depends on an underlying stream. Streamed entities that read data directly from the socket should returntrue. Self-contained entities should returnfalse. Wrapping entities should delegate this call to the wrapped entity.- Specified by:
isStreamingin interfaceHttpEntity- Returns:
trueif the entity content is streamed,falseotherwise
-
writeTo
Description copied from interface:HttpEntityWrites 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.
- Specified by:
writeToin interfaceHttpEntity- Parameters:
outStream- the output stream to write entity content to- Throws:
IOException- if an I/O error occurs
-
getTrailers
Description copied from interface:HttpEntityGets supplier of message trailers - headers sent after message body. May returnnullif trailers are not available.- Specified by:
getTrailersin interfaceHttpEntity
-
getTrailerNames
Description copied from interface:EntityDetailsGets the preliminary declaration of trailing headers.- Specified by:
getTrailerNamesin interfaceEntityDetails- Returns:
- the preliminary declaration of trailing headers.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
toString
-