Class AsyncInputStream.InboundBuffer
java.lang.Object
org.jboss.resteasy.reactive.client.handlers.AsyncInputStream.InboundBuffer
- Enclosing class:
AsyncInputStream
-
Constructor Summary
ConstructorsConstructorDescriptionInboundBuffer(io.vertx.core.Context context) InboundBuffer(io.vertx.core.Context context, long highWaterMark) -
Method Summary
Modifier and TypeMethodDescriptionclear()Clear the buffer synchronously.drainHandler(io.vertx.core.Handler<Void> handler) Set anhandlerto be called when the buffer is drained and the producer can resume writing to the buffer.exceptionHandler(io.vertx.core.Handler<Throwable> handler) Set anhandlerto be called when an exception is thrown by an handler.booleanfetch(long amount) Request a specificamountof elements to be fetched, the amount is added to the actual demand.handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler) Set anhandlerto be called with elements available from this buffer.booleanisEmpty()voidpause()Pause the buffer, it sets the buffer infetchmode and clears the actual demand.voidresume()Resume the buffer, and sets the buffer inflowingmode.intsize()booleanwrite(io.vertx.core.buffer.Buffer element) Write anelementto the buffer.
-
Constructor Details
-
InboundBuffer
public InboundBuffer(io.vertx.core.Context context) -
InboundBuffer
public InboundBuffer(io.vertx.core.Context context, long highWaterMark)
-
-
Method Details
-
write
public boolean write(io.vertx.core.buffer.Buffer element) Write anelementto the buffer. The element will be delivered synchronously to the handler when it is possible, otherwise it will be queued for later delivery.- Parameters:
element- the element to add- Returns:
falsewhen the producer should stop writing
-
fetch
public boolean fetch(long amount) Request a specificamountof elements to be fetched, the amount is added to the actual demand.Pending elements in the buffer will be delivered asynchronously on the context to the handler.
This method can be called from any thread.
- Returns:
truewhen the buffer will be drained
-
clear
Clear the buffer synchronously.No handler will be called.
- Returns:
- a reference to this, so the API can be used fluently
-
pause
public void pause()Pause the buffer, it sets the buffer infetchmode and clears the actual demand. -
resume
public void resume()Resume the buffer, and sets the buffer inflowingmode.Pending elements in the buffer will be delivered asynchronously on the context to the handler.
This method can be called from any thread.
-
handler
public AsyncInputStream.InboundBuffer handler(io.vertx.core.Handler<io.vertx.core.buffer.Buffer> handler) Set anhandlerto be called with elements available from this buffer.- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
drainHandler
Set anhandlerto be called when the buffer is drained and the producer can resume writing to the buffer.- Parameters:
handler- the handler to be called- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
Set anhandlerto be called when an exception is thrown by an handler.- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
isEmpty
public boolean isEmpty()- Returns:
- whether the buffer is empty
-
size
public int size()- Returns:
- the actual number of elements in the buffer
-