public class

StringBody

extends AbstractContentBody
java.lang.Object
   ↳ org.apache.http.entity.mime.content.AbstractContentBody
     ↳ org.apache.http.entity.mime.content.StringBody

Summary

Public Constructors
StringBody(String text, String mimeType, Charset charset)
Create a StringBody from the specified text, mime type and character set.
StringBody(String text, Charset charset)
Create a StringBody from the specified text and character set.
StringBody(String text)
Create a StringBody from the specified text.
Public Methods
static StringBody create(String text, String mimeType, Charset charset)
static StringBody create(String text)
static StringBody create(String text, Charset charset)
String getCharset()
long getContentLength()
String getFilename()
Reader getReader()
String getTransferEncoding()
void writeTo(OutputStream out)
void writeTo(OutputStream out, int mode)
This method is deprecated. use writeTo(OutputStream)
[Expand]
Inherited Methods
From class org.apache.http.entity.mime.content.AbstractContentBody
From class java.lang.Object
From interface org.apache.http.entity.mime.content.ContentBody
From interface org.apache.http.entity.mime.content.ContentDescriptor

Public Constructors

public StringBody (String text, String mimeType, Charset charset)

Create a StringBody from the specified text, mime type and character set.

Parameters
text to be used for the body, not null
mimeType the mime type, not null
charset the character set, may be null, in which case the US-ASCII charset is used
Throws
UnsupportedEncodingException
IllegalArgumentException if the text parameter is null
UnsupportedEncodingException

public StringBody (String text, Charset charset)

Create a StringBody from the specified text and character set. The mime type is set to "text/plain".

Parameters
text to be used for the body, not null
charset the character set, may be null, in which case the US-ASCII charset is used
Throws
UnsupportedEncodingException
IllegalArgumentException if the text parameter is null
UnsupportedEncodingException

public StringBody (String text)

Create a StringBody from the specified text. The mime type is set to "text/plain". The hosts default charset is used.

Parameters
text to be used for the body, not null
Throws
UnsupportedEncodingException
IllegalArgumentException if the text parameter is null
UnsupportedEncodingException

Public Methods

public static StringBody create (String text, String mimeType, Charset charset)

public static StringBody create (String text)

public static StringBody create (String text, Charset charset)

public String getCharset ()

public long getContentLength ()

public String getFilename ()

public Reader getReader ()

public String getTransferEncoding ()

public void writeTo (OutputStream out)

Throws
IOException

public void writeTo (OutputStream out, int mode)

This method is deprecated.
use writeTo(OutputStream)

Throws
IOException