Package org.apache.hc.core5.http.nio
Interface AsyncDataProducer
-
- All Superinterfaces:
ResourceHolder
- All Known Subinterfaces:
AsyncClientExchangeHandler,AsyncDataExchangeHandler,AsyncEntityProducer,AsyncPushProducer,AsyncRequestProducer,AsyncResponseProducer,AsyncServerExchangeHandler
- All Known Implementing Classes:
AbstractBinAsyncEntityProducer,AbstractCharAsyncEntityProducer,AbstractClassicEntityProducer,AbstractClassicServerExchangeHandler,AbstractServerExchangeHandler,AsyncEntityProducerWrapper,BasicAsyncEntityProducer,BasicAsyncServerExpectationDecorator,BasicClientExchangeHandler,BasicPushProducer,BasicRequestProducer,BasicResponseProducer,BasicServerExchangeHandler,ClassicToAsyncRequestProducer,ClassicToAsyncServerExchangeHandler,DigestingEntityProducer,FileEntityProducer,ImmediateResponseExchangeHandler,PathEntityProducer,ReactiveDataProducer,ReactiveEntityProducer,ReactiveServerExchangeHandler,StringAsyncEntityProducer
public interface AsyncDataProducer extends ResourceHolder
Abstract asynchronous data producer.- Since:
- 5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intavailable()Returns the number of bytes immediately available for output.voidproduce(DataStreamChannel channel)Triggered to signal the ability of the underlying data channel to accept more data.-
Methods inherited from interface org.apache.hc.core5.http.nio.ResourceHolder
releaseResources
-
-
-
-
Method Detail
-
available
int available()
Returns the number of bytes immediately available for output. This method can be used as a hint to control output events of the underlying I/O session.Please note this method should return zero if the data producer is unable to produce any more data, in which case
produce(DataStreamChannel)method will not get triggered. The producer can resume writing out data asynchronously once more data becomes available or request output readiness events withDataStreamChannel.requestOutput().- Returns:
- the number of bytes immediately available for output
- See Also:
produce(DataStreamChannel),DataStreamChannel.requestOutput()
-
produce
void produce(DataStreamChannel channel) throws java.io.IOException
Triggered to signal the ability of the underlying data channel to accept more data. The data producer can choose to write data immediately inside the call or asynchronously at some later point.Please note this method gets triggered only if
available()returns a positive value.- Parameters:
channel- the data channel capable of accepting more data.- Throws:
java.io.IOException- in case of an I/O error.- See Also:
available()
-
-