Class IncomingHttpEntity
- All Implemented Interfaces:
Closeable,AutoCloseable,EntityDetails,HttpEntity
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final InputStreamprivate final Headerprivate final Headerprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionIncomingHttpEntity(InputStream content, long len, boolean chunked, Header contentType, Header contentEncoding) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns a content stream of the entity.Returns content encoding of the entity, if known.longReturns length of the entity, if known.Returns content type of the entity, if known.Preliminary declaration of trailing headers.Returns supplier of message trailers - headers sent after message body.booleanReturns chunked transfer hint for this entity.booleanTells if the entity is capable of producing its data more than once.booleanTells 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 -
chunked
private final boolean chunked -
contentType
-
contentEncoding
-
-
Constructor Details
-
IncomingHttpEntity
IncomingHttpEntity(InputStream content, long len, boolean chunked, Header contentType, Header contentEncoding)
-
-
Method Details
-
isRepeatable
public boolean isRepeatable()Description copied from interface:HttpEntityTells 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:EntityDetailsReturns chunked transfer hint for this entity.The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.
- Specified by:
isChunkedin interfaceEntityDetails
-
getContentLength
public long getContentLength()Description copied from interface:EntityDetailsReturns length of the entity, if known.- Specified by:
getContentLengthin interfaceEntityDetails
-
getContentType
Description copied from interface:EntityDetailsReturns content type of the entity, if known.- Specified by:
getContentTypein interfaceEntityDetails
-
getContentEncoding
Description copied from interface:EntityDetailsReturns content encoding of the entity, if known.- Specified by:
getContentEncodingin interfaceEntityDetails
-
getContent
Description copied from interface:HttpEntityReturns 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:HttpEntityTells 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:HttpEntityReturns supplier of message trailers - headers sent after message body. May returnnullif trailers are not available.- Specified by:
getTrailersin interfaceHttpEntity
-
getTrailerNames
Description copied from interface:EntityDetailsPreliminary declaration of trailing headers.- Specified by:
getTrailerNamesin interfaceEntityDetails
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
toString
-