Class AsyncInputStream.InboundBuffer

java.lang.Object
org.jboss.resteasy.reactive.client.handlers.AsyncInputStream.InboundBuffer
Enclosing class:
AsyncInputStream

public static class AsyncInputStream.InboundBuffer extends Object
  • 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 an element to 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:
      false when the producer should stop writing
    • fetch

      public boolean fetch(long amount)
      Request a specific amount of 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:
      true when 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 in fetch mode and clears the actual demand.
    • resume

      public void resume()
      Resume the buffer, and sets the buffer in flowing mode.

      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 an handler to 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

      public AsyncInputStream.InboundBuffer drainHandler(io.vertx.core.Handler<Void> handler)
      Set an handler to 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

      public AsyncInputStream.InboundBuffer exceptionHandler(io.vertx.core.Handler<Throwable> handler)
      Set an handler to 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