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 TypeMethodDescriptionbuild()Creates new instance ofHttpEntitybased on the current state.chunked()Makes entity chunk coded.static EntityBuildercreate()byte[]Returns entity content as a byte array if set usingsetBinary(byte[])method.Returns content encoding of the entity, if set.ReturnsContentTypeof the entity, if set.getFile()Returns entity content as aFileif set usingsetFile(java.io.File)method.Returns entity content as a parameter list if set usingsetParameters(java.util.List)orsetParameters(org.apache.http.NameValuePair...)methods.Returns entity content as aSerializableif set usingsetSerializable(java.io.Serializable)method.Returns entity content as aInputStreamif set usingsetStream(java.io.InputStream)method.getText()Returns entity content as a string if set usingsetText(String)method.Makes entity GZIP compressed.booleanReturnstrueif entity is to be chunk coded,falseotherwise.booleanReturnstrueif entity is to be GZIP compressed,falseotherwise.setBinary(byte[] binary) Sets entity content as a byte array.setContentEncoding(String contentEncoding) Sets content encoding of the entity.setContentType(ContentType contentType) SetsContentTypeof the entity.Sets entity content as aFile.setParameters(List<NameValuePair> parameters) Sets entity content as a parameter list.setParameters(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 aInputStreamif 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 aSerializableif set usingsetSerializable(java.io.Serializable)method. -
setSerializable
Sets entity content as aSerializable. This method is mutually exclusive with: -
getFile
Returns entity content as aFileif set usingsetFile(java.io.File)method. -
setFile
Sets entity content as aFile. This method is mutually exclusive with: -
getContentType
ReturnsContentTypeof the entity, if set. -
setContentType
SetsContentTypeof the entity. -
getContentEncoding
Returns content encoding of the entity, if set. -
setContentEncoding
Sets content encoding of the entity. -
isChunked
public boolean isChunked()Returnstrueif entity is to be chunk coded,falseotherwise. -
chunked
Makes entity chunk coded. -
isGzipCompress
public boolean isGzipCompress()Returnstrueif entity is to be GZIP compressed,falseotherwise. -
gzipCompress
Makes entity GZIP compressed. -
build
Creates new instance ofHttpEntitybased on the current state.
-