@NotThreadSafe public class StringEntityHC4 extends AbstractHttpEntityHC4 implements java.lang.Cloneable
String.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
content |
chunked, contentEncoding, contentType, OUTPUT_BUFFER_SIZE| Constructor and Description |
|---|
StringEntityHC4(java.lang.String string)
Creates a StringEntityHC4 with the specified content.
|
StringEntityHC4(java.lang.String string,
java.nio.charset.Charset charset)
Creates a StringEntityHC4 with the specified content and charset.
|
StringEntityHC4(java.lang.String string,
ContentType contentType)
Creates a StringEntityHC4 with the specified content and content type.
|
StringEntityHC4(java.lang.String string,
java.lang.String charset)
Creates a StringEntityHC4 with the specified content and charset.
|
StringEntityHC4(java.lang.String string,
java.lang.String mimeType,
java.lang.String charset)
Deprecated.
(4.1.3) use
StringEntityHC4(String, ContentType) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
java.io.InputStream |
getContent() |
long |
getContentLength() |
boolean |
isRepeatable() |
boolean |
isStreaming()
Tells that this entity is not streaming.
|
void |
writeTo(java.io.OutputStream outstream) |
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentTypepublic StringEntityHC4(java.lang.String string,
ContentType contentType)
throws java.nio.charset.UnsupportedCharsetException
string - content to be used. Not null.contentType - content type to be used. May be null, in which case the default
MIME type ContentType.TEXT_PLAIN is assumed.java.lang.IllegalArgumentException - if the string parameter is nulljava.nio.charset.UnsupportedCharsetException - Thrown when the named charset is not available in
this instance of the Java virtual machine@Deprecated
public StringEntityHC4(java.lang.String string,
java.lang.String mimeType,
java.lang.String charset)
throws java.io.UnsupportedEncodingException
StringEntityHC4(String, ContentType)string - content to be used. Not null.mimeType - MIME type to be used. May be null, in which case the default
is HTTP.PLAIN_TEXT_TYPE i.e. "text/plain"charset - character set to be used. May be null, in which case the default
is HTTP.DEFAULT_CONTENT_CHARSET i.e. "ISO-8859-1"java.io.UnsupportedEncodingException - If the named charset is not supported.java.lang.IllegalArgumentException - if the string parameter is nullpublic StringEntityHC4(java.lang.String string,
java.lang.String charset)
throws java.nio.charset.UnsupportedCharsetException
string - content to be used. Not null.charset - character set to be used. May be null, in which case the default
is HTTP.DEFAULT_CONTENT_CHARSET is assumedjava.lang.IllegalArgumentException - if the string parameter is nulljava.nio.charset.UnsupportedCharsetException - Thrown when the named charset is not available in
this instance of the Java virtual machinepublic StringEntityHC4(java.lang.String string,
java.nio.charset.Charset charset)
string - content to be used. Not null.charset - character set to be used. May be null, in which case the default
is HTTP.DEFAULT_CONTENT_CHARSET is assumedjava.lang.IllegalArgumentException - if the string parameter is nullpublic StringEntityHC4(java.lang.String string)
throws java.io.UnsupportedEncodingException
ContentType.TEXT_PLAIN.string - content to be used. Not null.java.lang.IllegalArgumentException - if the string parameter is nulljava.io.UnsupportedEncodingException - if the default HTTP charset is not supported.public boolean isRepeatable()
isRepeatable in interface org.apache.http.HttpEntitypublic long getContentLength()
getContentLength in interface org.apache.http.HttpEntitypublic java.io.InputStream getContent()
throws java.io.IOException
getContent in interface org.apache.http.HttpEntityjava.io.IOExceptionpublic void writeTo(java.io.OutputStream outstream)
throws java.io.IOException
writeTo in interface org.apache.http.HttpEntityjava.io.IOExceptionpublic boolean isStreaming()
isStreaming in interface org.apache.http.HttpEntityfalsepublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionCopyright © 1999-2015 The Apache Software Foundation. All rights reserved.