Class Pump

java.lang.Object
io.vertx.mutiny.core.streams.Pump
All Implemented Interfaces:
MutinyDelegate

@Deprecated public class Pump extends Object implements MutinyDelegate
Deprecated.
Pumps data from a ReadStream to a WriteStream and performs flow control where necessary to prevent the write stream buffer from getting overfull.

Instances of this class read items from a ReadStream and write them to a WriteStream. If data can be read faster than it can be written this could result in the write queue of the WriteStream growing without bound, eventually causing it to exhaust all available RAM.

To prevent this, after each write, instances of this class check whether the write queue of the WriteStream is full, and if so, the ReadStream is paused, and a drainHandler is set on the WriteStream.

When the WriteStream has processed half of its backlog, the drainHandler will be called, which results in the pump resuming the ReadStream.

This class can be used to pump from any ReadStream to any WriteStream, e.g. from an HttpServerRequest to an AsyncFile, or from NetSocket to a WebSocket.

Please see the documentation for more information.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

  • Field Details

    • __TYPE_ARG

      public static final TypeArg<Pump> __TYPE_ARG
      Deprecated.
  • Constructor Details

    • Pump

      public Pump(io.vertx.core.streams.Pump delegate)
      Deprecated.
    • Pump

      public Pump(Object delegate)
      Deprecated.
  • Method Details

    • getDelegate

      public io.vertx.core.streams.Pump getDelegate()
      Deprecated.
      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate used by this Mutiny object of generated type
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Deprecated.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • pump

      @Deprecated public static <T> Pump pump(ReadStream<T> rs, WriteStream<T> ws)
      Deprecated.
      Parameters:
      rs - the read stream
      ws - the write stream
      Returns:
      the pump
    • pump

      @Deprecated public static <T> Pump pump(Flow.Publisher<T> rs, WriteStream<T> ws)
      Deprecated.
      Parameters:
      rs - the read stream
      ws - the write stream
      Returns:
      the pump
    • pump

      @Deprecated public static <T> Pump pump(ReadStream<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
      Deprecated.
      Parameters:
      rs - the read stream
      ws - the write stream
      writeQueueMaxSize - the max size of the write queue
      Returns:
      the pump
    • pump

      @Deprecated public static <T> Pump pump(Flow.Publisher<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
      Deprecated.
      Parameters:
      rs - the read stream
      ws - the write stream
      writeQueueMaxSize - the max size of the write queue
      Returns:
      the pump
    • setWriteQueueMaxSize

      @Deprecated public Pump setWriteQueueMaxSize(int maxSize)
      Deprecated.
      Parameters:
      maxSize - the max size
      Returns:
      a reference to this, so the API can be used fluently
    • start

      @Deprecated public Pump start()
      Deprecated.
      Returns:
      a reference to this, so the API can be used fluently
    • stop

      @Deprecated public Pump stop()
      Deprecated.
      Returns:
      a reference to this, so the API can be used fluently
    • numberPumped

      @Deprecated public int numberPumped()
      Deprecated.
      Returns:
    • newInstance

      public static Pump newInstance(io.vertx.core.streams.Pump arg)
      Deprecated.