public class StringAsyncEntityProducer extends AbstractCharAsyncEntityProducer
AsyncDataProducer
implementation that
generates data stream from content of a string.Constructor and Description |
---|
StringAsyncEntityProducer(CharSequence content) |
StringAsyncEntityProducer(CharSequence content,
ContentType contentType) |
StringAsyncEntityProducer(CharSequence content,
int bufferSize,
ContentType contentType) |
StringAsyncEntityProducer(CharSequence content,
int bufferSize,
int fragmentSizeHint,
ContentType contentType) |
Modifier and Type | Method and Description |
---|---|
protected int |
availableData()
Returns the number of bytes immediately available for output.
|
void |
failed(Exception cause)
Triggered to signal a failure in data generation.
|
Exception |
getException() |
boolean |
isRepeatable()
Determines whether the producer can consistently produce the same content
after invocation of
ResourceHolder.releaseResources() . |
protected void |
produceData(StreamChannel<CharBuffer> channel)
Triggered to signal the ability of the underlying char channel
to accept more data.
|
void |
releaseResources() |
available, getContentEncoding, getContentLength, getContentType, getTrailerNames, isChunked, produce
public StringAsyncEntityProducer(CharSequence content, int bufferSize, int fragmentSizeHint, ContentType contentType)
public StringAsyncEntityProducer(CharSequence content, int bufferSize, ContentType contentType)
public StringAsyncEntityProducer(CharSequence content, ContentType contentType)
public StringAsyncEntityProducer(CharSequence content)
public boolean isRepeatable()
AsyncEntityProducer
ResourceHolder.releaseResources()
.protected int availableData()
AbstractCharAsyncEntityProducer
availableData
in class AbstractCharAsyncEntityProducer
protected void produceData(StreamChannel<CharBuffer> channel) throws IOException
AbstractCharAsyncEntityProducer
StreamChannel
passed to this method is threading-safe.
produceData
in class AbstractCharAsyncEntityProducer
channel
- the data channel capable to accepting more data.IOException
- in case of an I/O error.public void failed(Exception cause)
AsyncEntityProducer
cause
- the cause of the failure.public Exception getException()
public void releaseResources()
releaseResources
in interface ResourceHolder
releaseResources
in class AbstractCharAsyncEntityProducer
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.