public abstract class AbstractHttpEntity extends Object implements HttpEntity
This class contains immutable attributes but subclasses may contain additional immutable or mutable attributes.
Modifier | Constructor and Description |
---|---|
protected |
AbstractHttpEntity(ContentType contentType,
String contentEncoding)
Constructs a new instance with the given attributes kept as immutable.
|
protected |
AbstractHttpEntity(ContentType contentType,
String contentEncoding,
boolean chunked)
Constructs a new instance with the given attributes kept as immutable.
|
protected |
AbstractHttpEntity(String contentType,
String contentEncoding)
Constructs a new instance with the given attributes kept as immutable.
|
protected |
AbstractHttpEntity(String contentType,
String contentEncoding,
boolean chunked)
Constructs a new instance with the given attributes kept as immutable.
|
Modifier and Type | Method and Description |
---|---|
String |
getContentEncoding()
Gets content encoding of this entity, if known.
|
String |
getContentType()
Gets content type of this entity, if known.
|
Set<String> |
getTrailerNames()
Gets the preliminary declaration of trailing headers.
|
Supplier<List<? extends Header>> |
getTrailers()
Gets supplier of message trailers - headers sent after message body.
|
boolean |
isChunked()
Tests the chunked transfer hint for this entity.
|
boolean |
isRepeatable()
Tests if the entity is capable of producing its data more than once.
|
String |
toString() |
static void |
writeTo(HttpEntity entity,
OutputStream outStream)
Writes an entity to an OutputStream.
|
void |
writeTo(OutputStream outStream)
Writes this entity to an OutputStream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContent, isStreaming
getContentLength
protected AbstractHttpEntity(String contentType, String contentEncoding, boolean chunked)
contentType
- The content-type string, may be null.contentEncoding
- The content encoding string, may be null.chunked
- Whether this entity should be chunked.protected AbstractHttpEntity(ContentType contentType, String contentEncoding, boolean chunked)
contentType
- The content-type, may be null.contentEncoding
- The content encoding string, may be null.chunked
- Whether this entity should be chunked.protected AbstractHttpEntity(String contentType, String contentEncoding)
The new instance:
contentType
- The content-type string, may be null.contentEncoding
- The content encoding string, may be null.protected AbstractHttpEntity(ContentType contentType, String contentEncoding)
The new instance:
contentType
- The content-type, may be null.contentEncoding
- The content encoding string, may be null.public static void writeTo(HttpEntity entity, OutputStream outStream) throws IOException
entity
- The entity to write, never null.outStream
- Where to write the entity, never null.IOException
- if the entity cannot generate its content stream; also thrown if the output stream is closed.UnsupportedOperationException
- if entity content cannot be represented as InputStream
.public void writeTo(OutputStream outStream) throws IOException
writeTo
in interface HttpEntity
outStream
- Where to write the entity, never null.IOException
- if the entity cannot generate its content stream; also thrown if the output stream is closed.UnsupportedOperationException
- if entity content cannot be represented as InputStream
.public final String getContentType()
EntityDetails
getContentType
in interface EntityDetails
null
.public final String getContentEncoding()
EntityDetails
getContentEncoding
in interface EntityDetails
null
.public final boolean isChunked()
The behavior of wrapping entities is implementation dependent, but should respect the primary purpose.
This implementation always returns false
.
isChunked
in interface EntityDetails
public boolean isRepeatable()
This implementation always returns false
.
isRepeatable
in interface HttpEntity
public Supplier<List<? extends Header>> getTrailers()
null
if trailers are not available.
This implementation always returns null
.
getTrailers
in interface HttpEntity
public Set<String> getTrailerNames()
This implementation always returns an immutable empty set.
getTrailerNames
in interface EntityDetails
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.