Top Description Fields Constructors Methods
org.apache.http.entity

public abstract Class AbstractHttpEntity

extends Object
implements HttpEntity
Class Inheritance
All Implemented Interfaces
org.apache.http.HttpEntity
Known Direct Subclasses
org.apache.http.entity.BasicHttpEntity, org.apache.http.entity.ByteArrayEntity, org.apache.http.entity.EntityTemplate, org.apache.http.entity.FileEntity, org.apache.http.entity.InputStreamEntity, org.apache.http.entity.SerializableEntity, org.apache.http.entity.StringEntity
Imports
java.io.IOException, org.apache.http.Header, .HttpEntity, org.apache.http.message.BasicHeader, org.apache.http.protocol.HTTP

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

Field Summary

Modifier and TypeField and Description
protected boolean
protected Header
protected Header
protected static final int
OUTPUT_BUFFER_SIZE

Buffer size for output stream processing.

Constructor Summary

AccessConstructor and Description
protected
AbstractHttpEntity()

Protected default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
consumeContent()

Implements org.apache.http.HttpEntity.consumeContent.

Deprecated (4.1) Either use getContent() and call java.io.InputStream#close() on that; otherwise call writeTo(java.io.OutputStream) which is required to free the resources.
The default implementation does not consume anything.
public Header

Returns:

the Content-Encoding header, or null
getContentEncoding
()

Implements org.apache.http.HttpEntity.getContentEncoding.

Obtains the Content-Encoding header.
public Header

Returns:

the Content-Type header, or null
getContentType
()

Implements org.apache.http.HttpEntity.getContentType.

Obtains the Content-Type header.
public boolean

Returns:

the 'chunked' flag
isChunked
()

Implements org.apache.http.HttpEntity.isChunked.

Obtains the 'chunked' flag.
public void
setChunked(final boolean
the new 'chunked' flag
b
)

Specifies the 'chunked' flag.

public void
setContentEncoding(final Header
the new Content-Encoding header, or null to unset
contentEncoding
)

Specifies the Content-Encoding header.

public void
setContentEncoding(final String
the new Content-Encoding header, or null to unset
ceString
)

Specifies the Content-Encoding header, as a string.

public void
setContentType(final Header
the new Content-Type header, or null to unset
contentType
)

Specifies the Content-Type header.

public void
setContentType(final String
the new Content-Type header, or null to unset
ctString
)

Specifies the Content-Type header, as a string.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

chunkedback to summary
protected boolean chunked
contentEncodingback to summary
protected Header contentEncoding
contentTypeback to summary
protected Header contentType
OUTPUT_BUFFER_SIZEback to summary
protected static final int OUTPUT_BUFFER_SIZE

Buffer size for output stream processing.

Since
4.3

Constructor Detail

AbstractHttpEntityback to summary
protected AbstractHttpEntity()

Protected default constructor. The contentType, contentEncoding and chunked attributes of the created object are set to null, null and false, respectively.

Method Detail

consumeContentback to summary
public void consumeContent() throws IOException

Implements org.apache.http.HttpEntity.consumeContent.

Deprecated

(4.1) Either use getContent() and call java.io.InputStream#close() on that; otherwise call writeTo(java.io.OutputStream) which is required to free the resources.

The default implementation does not consume anything.

Annotations
@Override
@Deprecated
Exceptions
IOException:

Doc from org.apache.http.HttpEntity.consumeContent.

if an I/O error occurs.

getContentEncodingback to summary
public Header getContentEncoding()

Implements org.apache.http.HttpEntity.getContentEncoding.

Obtains the Content-Encoding header. The default implementation returns the value of the contentEncoding attribute.

Returns:Header

the Content-Encoding header, or null

Annotations
@Override
getContentTypeback to summary
public Header getContentType()

Implements org.apache.http.HttpEntity.getContentType.

Obtains the Content-Type header. The default implementation returns the value of the contentType attribute.

Returns:Header

the Content-Type header, or null

Annotations
@Override
isChunkedback to summary
public boolean isChunked()

Implements org.apache.http.HttpEntity.isChunked.

Obtains the 'chunked' flag. The default implementation returns the value of the chunked attribute.

Returns:boolean

the 'chunked' flag

Annotations
@Override
setChunkedback to summary
public void setChunked(final boolean b)

Specifies the 'chunked' flag.

Note that the chunked setting is a hint only. If using HTTP/1.0, chunking is never performed. Otherwise, even if chunked is false, HttpClient must use chunk coding if the entity content length is unknown (-1).

The default implementation sets the value of the chunked attribute.

Parameters
b:boolean

the new 'chunked' flag

setContentEncodingback to summary
public void setContentEncoding(final Header contentEncoding)

Specifies the Content-Encoding header. The default implementation sets the value of the contentEncoding attribute.

Parameters
contentEncoding:Header

the new Content-Encoding header, or null to unset

setContentEncodingback to summary
public void setContentEncoding(final String ceString)

Specifies the Content-Encoding header, as a string. The default implementation calls setContentEncoding(Header).

Parameters
ceString:String

the new Content-Encoding header, or null to unset

setContentTypeback to summary
public void setContentType(final Header contentType)

Specifies the Content-Type header. The default implementation sets the value of the contentType attribute.

Parameters
contentType:Header

the new Content-Type header, or null to unset

setContentTypeback to summary
public void setContentType(final String ctString)

Specifies the Content-Type header, as a string. The default implementation calls setContentType(Header).

Parameters
ctString:String

the new Content-Type header, or null to unset

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