public class StringRequestEntity extends java.lang.Object implements RequestEntity
| 构造器和说明 |
|---|
StringRequestEntity(java.lang.String content)
已过时。
use
StringRequestEntity(String, String, String) instead |
StringRequestEntity(java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
Creates a new entity with the given content, content category, and charset.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.String |
getCharset() |
java.lang.String |
getContent() |
long |
getContentLength()
Gets the request entity's length.
|
java.lang.String |
getContentType()
Gets the entity's content category.
|
boolean |
isRepeatable()
Tests if
RequestEntity.writeRequest(OutputStream) can be called more than once. |
void |
writeRequest(java.io.OutputStream out)
Writes the request entity to the given stream.
|
public StringRequestEntity(java.lang.String content)
StringRequestEntity(String, String, String) insteadCreates a new entity with the given content. This constructor will use the default platform charset to convert the content string and will provide no content category.
content - The content to set.StringRequestEntity(String, String, String)public StringRequestEntity(java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
throws java.io.UnsupportedEncodingException
content - The content to set.contentType - The category of the content, or null. The value retured
by getContentType(). If this content category contains a charset and the charset
parameter is null, the content's category charset will be used.charset - The charset of the content, or null. Used to convert the
content to bytes. If the content category does not contain a charset and charset is not null,
then the charset will be appended to the content category.java.io.UnsupportedEncodingExceptionpublic java.lang.String getContentType()
RequestEntitygetContentType 在接口中 RequestEntityHttpMethod.setRequestHeader(String, String)public boolean isRepeatable()
RequestEntityRequestEntity.writeRequest(OutputStream) can be called more than once.isRepeatable 在接口中 RequestEntitytruepublic void writeRequest(java.io.OutputStream out)
throws java.io.IOException
RequestEntitywriteRequest 在接口中 RequestEntityjava.io.IOExceptionpublic long getContentLength()
RequestEntityEntityEnclosingMethod will use chunk encoding to
transmit the request entity.getContentLength 在接口中 RequestEntitypublic java.lang.String getContent()
public java.lang.String getCharset()
null if
no charset as been specified.