Package org.apache.http.client.entity
Class EntityBuilder
java.lang.Object
org.apache.http.client.entity.EntityBuilder
Builder for
HttpEntity
instances.
Several setter methods of this builder are mutually exclusive. In case of multiple invocations of the following methods only the last one will have effect:
- Since:
- 4.3
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.http.HttpEntity
build()
Creates new instance ofHttpEntity
based on the current state.chunked()
Makes entity chunk coded.static EntityBuilder
create()
byte[]
Returns entity content as a byte array if set usingsetBinary(byte[])
method.Returns content encoding of the entity, if set.org.apache.http.entity.ContentType
ReturnsContentType
of the entity, if set.getFile()
Returns entity content as aFile
if set usingsetFile(java.io.File)
method.List
<org.apache.http.NameValuePair> Returns entity content as a parameter list if set usingsetParameters(java.util.List)
orsetParameters(org.apache.http.NameValuePair...)
methods.Returns entity content as aSerializable
if set usingsetSerializable(java.io.Serializable)
method.Returns entity content as aInputStream
if set usingsetStream(java.io.InputStream)
method.getText()
Returns entity content as a string if set usingsetText(String)
method.Makes entity GZIP compressed.boolean
Returnstrue
if entity is to be chunk coded,false
otherwise.boolean
Returnstrue
if entity is to be GZIP compressed,false
otherwise.setBinary
(byte[] binary) Sets entity content as a byte array.setContentEncoding
(String contentEncoding) Sets content encoding of the entity.setContentType
(org.apache.http.entity.ContentType contentType) SetsContentType
of the entity.Sets entity content as aFile
.setParameters
(List<org.apache.http.NameValuePair> parameters) Sets entity content as a parameter list.setParameters
(org.apache.http.NameValuePair... parameters) Sets entity content as a parameter list.setSerializable
(Serializable serializable) Sets entity content as aSerializable
.setStream
(InputStream stream) Sets entity content as aInputStream
.Sets entity content as a string.
-
Method Details
-
create
-
getText
Returns entity content as a string if set usingsetText(String)
method. -
setText
Sets entity content as a string. This method is mutually exclusive with: -
getBinary
public byte[] getBinary()Returns entity content as a byte array if set usingsetBinary(byte[])
method. -
setBinary
Sets entity content as a byte array. This method is mutually exclusive with: -
getStream
Returns entity content as aInputStream
if set usingsetStream(java.io.InputStream)
method. -
setStream
Sets entity content as aInputStream
. This method is mutually exclusive with: -
getParameters
Returns entity content as a parameter list if set usingsetParameters(java.util.List)
orsetParameters(org.apache.http.NameValuePair...)
methods. -
setParameters
Sets entity content as a parameter list. This method is mutually exclusive with: -
setParameters
Sets entity content as a parameter list. This method is mutually exclusive with: -
getSerializable
Returns entity content as aSerializable
if set usingsetSerializable(java.io.Serializable)
method. -
setSerializable
Sets entity content as aSerializable
. This method is mutually exclusive with: -
getFile
Returns entity content as aFile
if set usingsetFile(java.io.File)
method. -
setFile
Sets entity content as aFile
. This method is mutually exclusive with: -
getContentType
public org.apache.http.entity.ContentType getContentType()ReturnsContentType
of the entity, if set. -
setContentType
SetsContentType
of the entity. -
getContentEncoding
Returns content encoding of the entity, if set. -
setContentEncoding
Sets content encoding of the entity. -
isChunked
public boolean isChunked()Returnstrue
if entity is to be chunk coded,false
otherwise. -
chunked
Makes entity chunk coded. -
isGzipCompress
public boolean isGzipCompress()Returnstrue
if entity is to be GZIP compressed,false
otherwise. -
gzipCompress
Makes entity GZIP compressed. -
build
public org.apache.http.HttpEntity build()Creates new instance ofHttpEntity
based on the current state.
-