public class StringBody extends java.lang.Object implements ResponseBody
| Constructor and Description |
|---|
StringBody(java.lang.String body) |
StringBody(java.lang.String body,
MediaType mediaType) |
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength()
Get the content-length of the message body, if the length is unknown, return a negative value.
|
MediaType |
contentType()
Get the content-type of the message body, including charset.
|
boolean |
isChunked()
Tells about chunked encoding for this entity.
|
boolean |
isRepeatable()
Can it be reused?
|
void |
writeTo(java.io.OutputStream output)
Write the body to the output stream.
|
public StringBody(java.lang.String body)
public StringBody(java.lang.String body,
MediaType mediaType)
public boolean isRepeatable()
ResponseBodyisRepeatable in interface ResponseBodypublic boolean isChunked()
ResponseBodyThe behavior of wrapping entities is implementation dependent, but should respect the primary purpose.
isChunked in interface ResponseBodytrue if chunked encoding is preferred for this entity, or false if it is notpublic long contentLength()
ResponseBodycontentLength in interface ResponseBodypublic MediaType contentType()
ResponseBodycontentType in interface ResponseBodyapplication/json; charset=utf-8.public void writeTo(java.io.OutputStream output)
throws java.io.IOException
ResponseBodywriteTo in interface ResponseBodyoutput - the output stream to write the body.java.io.IOException