public class StringBody extends AbstractContentBody
Description:
| 构造器和说明 |
|---|
StringBody(String text)
Create a StringBody from the specified text.
|
StringBody(String text,
Charset charset)
Create a StringBody from the specified text and character set.
|
StringBody(String text,
ContentType contentType) |
StringBody(String text,
String mimeType,
Charset charset)
Create a StringBody from the specified text, MIME type and character set.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static StringBody |
create(String text)
已过时。
(4.3) use
StringBody(String, ContentType)
or |
static StringBody |
create(String text,
Charset charset)
已过时。
(4.3) use
StringBody(String, ContentType) |
static StringBody |
create(String text,
String mimeType,
Charset charset)
已过时。
(4.3) use
StringBody(String, ContentType)
or |
long |
getContentLength()
Returns the body descriptors content-length.
|
String |
getFilename() |
Reader |
getReader() |
String |
getTransferEncoding()
Returns the body descriptors transfer encoding.
|
void |
writeTo(OutputStream out) |
getCharset, getContentType, getMimeTypepublic StringBody(String text, String mimeType, Charset charset) throws UnsupportedEncodingException
text - to be used for the body, not nullmimeType - the MIME type, not nullcharset - the character set, may be null, in which case the US-ASCII charset is usedUnsupportedEncodingExceptionIllegalArgumentException - if the text parameter is nullpublic StringBody(String text, Charset charset) throws UnsupportedEncodingException
text - to be used for the body, not nullcharset - the character set, may be null, in which case the US-ASCII charset is usedUnsupportedEncodingExceptionIllegalArgumentException - if the text parameter is nullpublic StringBody(String text) throws UnsupportedEncodingException
text - to be used for the body, not nullUnsupportedEncodingExceptionIllegalArgumentException - if the text parameter is nullpublic StringBody(String text, ContentType contentType)
@Deprecated public static StringBody create(String text, String mimeType, Charset charset) throws IllegalArgumentException
StringBody(String, ContentType)
orIllegalArgumentException@Deprecated public static StringBody create(String text, Charset charset) throws IllegalArgumentException
StringBody(String, ContentType)IllegalArgumentException@Deprecated public static StringBody create(String text) throws IllegalArgumentException
StringBody(String, ContentType)
orIllegalArgumentExceptionpublic Reader getReader()
public void writeTo(OutputStream out) throws IOException
IOExceptionpublic String getTransferEncoding()
ContentBodypublic long getContentLength()
ContentBodypublic String getFilename()
Copyright © 2019. All rights reserved.