content
Deprecated.
(4.2)
Closeable
, AutoCloseable
, HttpEntity
, HttpAsyncContentProducer
, ProducingNHttpEntity
String
object.private final byte[]
private final ByteBuffer
protected final ByteBuffer
protected final byte[]
chunked, contentEncoding, contentType, OUTPUT_BUFFER_SIZE
NStringEntity(String s,
String charset)
NStringEntity(String s,
Charset charset)
NStringEntity(String s,
ContentType contentType)
void
close()
void
finish()
close()
long
boolean
boolean
void
produceContent(ContentEncoder encoder,
IOControl ioControl)
ContentEncoder
.void
writeTo(OutputStream outStream)
consumeContent, getContentEncoding, getContentType, isChunked, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
consumeContent, getContentEncoding, getContentType, isChunked
s
- content to be used. Not null
.contentType
- content type to be used. May be null
, in which case
ContentType.TEXT_PLAIN
is assumed.IllegalArgumentException
- if the string parameter is nulls
- content to be used. Not null
.charset
- character set to be used. May be null
, in which case the default
is HTTP.DEF_CONTENT_CHARSET
is assumedIllegalArgumentException
- if the string parameter is nullUnsupportedEncodingException
- Thrown when the named charset is not available in
this instance of the Java virtual machines
- content to be used. Not null
.charset
- character set to be used. May be null
, in which case the default
is HTTP.DEF_CONTENT_CHARSET
is assumedIllegalArgumentException
- if the string parameter is nullContentType.TEXT_PLAIN
.s
- content to be used. Not null
.IllegalArgumentException
- if the string parameter is nullUnsupportedEncodingException
- if the default HTTP charset is not supported.HttpAsyncContentProducer
isRepeatable
in interface HttpAsyncContentProducer
isRepeatable
in interface HttpEntity
HttpEntity
getContentLength
in interface HttpEntity
Long.MAX_VALUE
,
a negative number is returned.close
in interface AutoCloseable
close
in interface Closeable
close()
finish
in interface ProducingNHttpEntity
HttpAsyncContentProducer
ContentEncoder
.
The IOControl
interface can be used to suspend output event
notifications if the entity is temporarily unable to produce more content.
When all content is finished, the producer MUST call
ContentEncoder.complete()
. Failure to do so may cause the entity
to be incorrectly delimited.
Please note that the ContentEncoder
object is not thread-safe and
should only be used within the context of this method call.
The IOControl
object can be shared and used on other thread
to resume output event notifications when more content is made available.
produceContent
in interface HttpAsyncContentProducer
produceContent
in interface ProducingNHttpEntity
encoder
- content encoder.ioControl
- I/O control of the underlying connection.IOException
HttpEntity
true
. Self-contained entities should return
false
. Wrapping entities should delegate this call
to the wrapped entity.isStreaming
in interface HttpEntity
true
if the entity content is streamed,
false
otherwiseHttpEntity
Repeatable
entities are expected
to create a new instance of InputStream
for each invocation
of this method and therefore can be consumed multiple times.
Entities that are not repeatable
are expected
to return the same InputStream
instance and therefore
may not be consumed more than once.
IMPORTANT: Please note all entity implementations must ensure that
all allocated resources are properly deallocated after
the InputStream.close()
method is invoked.
getContent
in interface HttpEntity
HttpEntity
IMPORTANT: Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.
writeTo
in interface HttpEntity
outStream
- the output stream to write entity content toIOException
- if an I/O error occurs