Class AbstractHttpEntity
java.lang.Object
org.apache.hc.core5.http.io.entity.AbstractHttpEntity
- All Implemented Interfaces:
Closeable,AutoCloseable,EntityDetails,HttpEntity
- Direct Known Subclasses:
BasicHttpEntity,ByteArrayEntity,ByteBufferEntity,EntityTemplate,FileEntity,InputStreamEntity,PathEntity,SerializableEntity,StringEntity
Abstract base class for mutable entities. Provides the commonly used attributes for streamed and
self-contained implementations.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractHttpEntity(String contentType, String contentEncoding) protectedAbstractHttpEntity(String contentType, String contentEncoding, boolean chunked) protectedAbstractHttpEntity(ContentType contentType, String contentEncoding) protectedAbstractHttpEntity(ContentType contentType, String contentEncoding, boolean chunked) -
Method Summary
Modifier and TypeMethodDescriptionfinal StringReturns content encoding of the entity, if known.final StringReturns content type of the entity, if known.Preliminary declaration of trailing headers.Returns supplier of message trailers - headers sent after message body.final booleanReturns chunked transfer hint for this entity.booleanTells if the entity is capable of producing its data more than once.toString()voidwriteTo(OutputStream outStream) Writes the entity content out to the output stream.static voidwriteTo(HttpEntity entity, OutputStream outStream) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hc.core5.http.EntityDetails
getContentLengthMethods inherited from interface org.apache.hc.core5.http.HttpEntity
getContent, isStreaming
-
Field Details
-
OUTPUT_BUFFER_SIZE
static final int OUTPUT_BUFFER_SIZE- See Also:
-
contentType
-
contentEncoding
-
chunked
private final boolean chunked
-
-
Constructor Details
-
AbstractHttpEntity
-
AbstractHttpEntity
-
AbstractHttpEntity
-
AbstractHttpEntity
-
-
Method Details
-
writeTo
- Throws:
IOException
-
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
-
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
-
isChunked
public final 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
-
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.
-
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
-
toString
-