public class EntityBuilder extends Object
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:
| Modifier and Type | Method and Description | 
|---|---|
| org.apache.hc.core5.http.HttpEntity | build()Creates new instance of  HttpEntitybased on the current state. | 
| EntityBuilder | chunked()Makes entity chunk coded. | 
| static EntityBuilder | create() | 
| byte[] | getBinary()Returns entity content as a byte array if set using
  setBinary(byte[])method. | 
| String | getContentEncoding()Returns content encoding of the entity, if set. | 
| org.apache.hc.core5.http.ContentType | getContentType()Returns  ContentTypeof the entity, if set. | 
| File | getFile()Returns entity content as a  Fileif set usingsetFile(java.io.File)method. | 
| List<org.apache.hc.core5.http.NameValuePair> | getParameters()Returns entity content as a parameter list if set using
  setParameters(java.util.List)orsetParameters(NameValuePair...)methods. | 
| Serializable | getSerializable()Returns entity content as a  Serializableif set usingsetSerializable(java.io.Serializable)method. | 
| InputStream | getStream()Returns entity content as a  InputStreamif set usingsetStream(java.io.InputStream)method. | 
| String | getText()Returns entity content as a string if set using  setText(String)method. | 
| EntityBuilder | gzipCompressed()Makes entity GZIP compressed. | 
| boolean | isChunked()Returns  trueif entity is to be chunk coded,falseotherwise. | 
| boolean | isGzipCompressed()Returns  trueif entity is to be GZIP compressed,falseotherwise. | 
| EntityBuilder | setBinary(byte[] binary)Sets entity content as a byte array. | 
| EntityBuilder | setContentEncoding(String contentEncoding)Sets content encoding of the entity. | 
| EntityBuilder | setContentType(org.apache.hc.core5.http.ContentType contentType)Sets  ContentTypeof the entity. | 
| EntityBuilder | setFile(File file)Sets entity content as a  File. | 
| EntityBuilder | setParameters(List<org.apache.hc.core5.http.NameValuePair> parameters)Sets entity content as a parameter list. | 
| EntityBuilder | setParameters(org.apache.hc.core5.http.NameValuePair... parameters)Sets entity content as a parameter list. | 
| EntityBuilder | setSerializable(Serializable serializable)Sets entity content as a  Serializable. | 
| EntityBuilder | setStream(InputStream stream)Sets entity content as a  InputStream. | 
| EntityBuilder | setText(String text)Sets entity content as a string. | 
public static EntityBuilder create()
public String getText()
setText(String) method.public EntityBuilder setText(String text)
setBinary(byte[]),
 setStream(java.io.InputStream) ,
 setSerializable(java.io.Serializable) ,
 setParameters(java.util.List),
 setParameters(NameValuePair...)
 setFile(java.io.File) methods.public byte[] getBinary()
setBinary(byte[]) method.public EntityBuilder setBinary(byte[] binary)
setText(String),
 setStream(java.io.InputStream) ,
 setSerializable(java.io.Serializable) ,
 setParameters(java.util.List),
 setParameters(NameValuePair...)
 setFile(java.io.File) methods.public InputStream getStream()
InputStream if set using
 setStream(java.io.InputStream) method.public EntityBuilder setStream(InputStream stream)
InputStream. This method is mutually exclusive with
 setText(String),
 setBinary(byte[]),
 setSerializable(java.io.Serializable) ,
 setParameters(java.util.List),
 setParameters(NameValuePair...)
 setFile(java.io.File) methods.public List<org.apache.hc.core5.http.NameValuePair> getParameters()
setParameters(java.util.List) or
 setParameters(NameValuePair...) methods.public EntityBuilder setParameters(List<org.apache.hc.core5.http.NameValuePair> parameters)
setText(String),
 setBinary(byte[]),
 setStream(java.io.InputStream) ,
 setSerializable(java.io.Serializable) ,
 setFile(java.io.File) methods.public EntityBuilder setParameters(org.apache.hc.core5.http.NameValuePair... parameters)
setText(String),
 setBinary(byte[]),
 setStream(java.io.InputStream) ,
 setSerializable(java.io.Serializable) ,
 setFile(java.io.File) methods.public Serializable getSerializable()
Serializable if set using
 setSerializable(java.io.Serializable) method.public EntityBuilder setSerializable(Serializable serializable)
Serializable. This method is mutually exclusive with
 setText(String),
 setBinary(byte[]),
 setStream(java.io.InputStream) ,
 setParameters(java.util.List),
 setParameters(NameValuePair...)
 setFile(java.io.File) methods.public File getFile()
File if set using
 setFile(java.io.File) method.public EntityBuilder setFile(File file)
File. This method is mutually exclusive with
 setText(String),
 setBinary(byte[]),
 setStream(java.io.InputStream) ,
 setParameters(java.util.List),
 setParameters(NameValuePair...)
 setSerializable(java.io.Serializable) methods.public org.apache.hc.core5.http.ContentType getContentType()
ContentType of the entity, if set.public EntityBuilder setContentType(org.apache.hc.core5.http.ContentType contentType)
ContentType of the entity.public String getContentEncoding()
public EntityBuilder setContentEncoding(String contentEncoding)
public boolean isChunked()
true if entity is to be chunk coded, false otherwise.public EntityBuilder chunked()
public boolean isGzipCompressed()
true if entity is to be GZIP compressed, false otherwise.public EntityBuilder gzipCompressed()
public org.apache.hc.core5.http.HttpEntity build()
HttpEntity based on the current state.Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.