Top Description Fields Constructors Methods
org.apache.hc.core5.http.io.entity

public abstract Class AbstractHttpEntity

extends Object
implements HttpEntity
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.HttpEntity, java.io.Closeable, java.lang.AutoCloseable, org.apache.hc.core5.http.EntityDetails
Known Direct Subclasses
org.apache.hc.core5.http.io.entity.BasicHttpEntity, org.apache.hc.core5.http.io.entity.ByteArrayEntity, org.apache.hc.core5.http.io.entity.ByteBufferEntity, org.apache.hc.core5.http.io.entity.EntityTemplate, org.apache.hc.core5.http.io.entity.FileEntity, org.apache.hc.core5.http.io.entity.InputStreamEntity, org.apache.hc.core5.http.io.entity.PathEntity, org.apache.hc.core5.http.io.entity.SerializableEntity, org.apache.hc.core5.http.io.entity.StringEntity
Imports
java.io.IOException, .InputStream, .OutputStream, java.util.Collections, .List, .Set, org.apache.hc.core5.function.Supplier, org.apache.hc.core5.http.ContentType, .Header, .HttpEntity, org.apache.hc.core5.util.Args

Abstract base class for mutable entities. Provides the commonly used attributes for streamed and self-contained implementations.
Since
4.0

Field Summary

Modifier and TypeField and Description
private final boolean
private final String
private final String
pack-priv static final int

Constructor Summary

AccessConstructor and Description
protected
AbstractHttpEntity(final String contentType, final String contentEncoding, final boolean chunked)

protected
AbstractHttpEntity(final ContentType contentType, final String contentEncoding, final boolean chunked)

protected
AbstractHttpEntity(final String contentType, final String contentEncoding)

protected
AbstractHttpEntity(final ContentType contentType, final String contentEncoding)

Method Summary

Modifier and TypeMethod and Description
public final String
getContentEncoding()

Implements org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Returns content encoding of the entity, if known.
public final String
getContentType()

Implements org.apache.hc.core5.http.EntityDetails.getContentType.

Returns content type of the entity, if known.
public Set<String>
getTrailerNames()

Implements org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Preliminary declaration of trailing headers.
public Supplier<List<? extends Header>>
getTrailers()

Implements org.apache.hc.core5.http.HttpEntity.getTrailers.

Returns supplier of message trailers - headers sent after message body.
public final boolean
isChunked()

Implements org.apache.hc.core5.http.EntityDetails.isChunked.

Returns chunked transfer hint for this entity.
public boolean
isRepeatable()

Implements org.apache.hc.core5.http.HttpEntity.isRepeatable.

Tells if the entity is capable of producing its data more than once.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public static void
writeTo(final HttpEntity entity, final OutputStream outStream)

public void
writeTo(final OutputStream
the output stream to write entity content to
outStream
)

Implements org.apache.hc.core5.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

chunkedback to summary
private final boolean chunked
contentEncodingback to summary
private final String contentEncoding
contentTypeback to summary
private final String contentType
OUTPUT_BUFFER_SIZEback to summary
pack-priv static final int OUTPUT_BUFFER_SIZE

Constructor Detail

AbstractHttpEntityback to summary
protected AbstractHttpEntity(final String contentType, final String contentEncoding, final boolean chunked)
AbstractHttpEntityback to summary
protected AbstractHttpEntity(final ContentType contentType, final String contentEncoding, final boolean chunked)
AbstractHttpEntityback to summary
protected AbstractHttpEntity(final String contentType, final String contentEncoding)
AbstractHttpEntityback to summary
protected AbstractHttpEntity(final ContentType contentType, final String contentEncoding)

Method Detail

getContentEncodingback to summary
public final String getContentEncoding()

Implements org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Doc from org.apache.hc.core5.http.EntityDetails.getContentEncoding.

Returns content encoding of the entity, if known.

Annotations
@Override
getContentTypeback to summary
public final String getContentType()

Implements org.apache.hc.core5.http.EntityDetails.getContentType.

Doc from org.apache.hc.core5.http.EntityDetails.getContentType.

Returns content type of the entity, if known.

Annotations
@Override
getTrailerNamesback to summary
public Set<String> getTrailerNames()

Implements org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Doc from org.apache.hc.core5.http.EntityDetails.getTrailerNames.

Preliminary declaration of trailing headers.

Annotations
@Override
getTrailersback to summary
public Supplier<List<? extends Header>> getTrailers()

Implements org.apache.hc.core5.http.HttpEntity.getTrailers.

Doc from org.apache.hc.core5.http.HttpEntity.getTrailers.

Returns supplier of message trailers - headers sent after message body. May return null if trailers are not available.

Annotations
@Override
isChunkedback to summary
public final boolean isChunked()

Implements org.apache.hc.core5.http.EntityDetails.isChunked.

Doc from org.apache.hc.core5.http.EntityDetails.isChunked.

Returns chunked transfer hint for this entity.

The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.

Annotations
@Override
isRepeatableback to summary
public boolean isRepeatable()

Implements org.apache.hc.core5.http.HttpEntity.isRepeatable.

Doc from org.apache.hc.core5.http.HttpEntity.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.

Returns:boolean

true if the entity is repeatable, false otherwise.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeToback to summary
public static void writeTo(final HttpEntity entity, final OutputStream outStream) throws IOException
writeToback to summary
public void writeTo(final OutputStream outStream) throws IOException

Implements org.apache.hc.core5.http.HttpEntity.writeTo.

Doc from org.apache.hc.core5.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.

Parameters
outStream:OutputStream

the output stream to write entity content to

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs