Class Pump
- java.lang.Object
-
- io.vertx.reactivex.core.streams.Pump
-
public class Pump extends Object
Pumps data from aReadStream
to aWriteStream
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 aWriteStream
. If data can be read faster than it can be written this could result in the write queue of theWriteStream
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, theReadStream
is paused, and adrainHandler
is set on theWriteStream
.When the
WriteStream
has processed half of its backlog, thedrainHandler
will be called, which results in the pump resuming theReadStream
.This class can be used to pump from any
ReadStream
to anyWriteStream
, e.g. from anHttpServerRequest
to anAsyncFile
, or fromNetSocket
to aWebSocket
.Please see the documentation for more information.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<Pump>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object o)
Pump
getDelegate()
int
hashCode()
static Pump
newInstance(Pump arg)
int
numberPumped()
Deprecated.static <T> Pump
pump(io.reactivex.Flowable<T> rs, WriteStream<T> ws)
Deprecated.static <T> Pump
pump(io.reactivex.Flowable<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
Deprecated.static <T> Pump
pump(ReadStream<T> rs, WriteStream<T> ws)
Deprecated.static <T> Pump
pump(ReadStream<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
Deprecated.Pump
setWriteQueueMaxSize(int maxSize)
Deprecated.Pump
start()
Deprecated.Pump
stop()
Deprecated.String
toString()
-
-
-
Method Detail
-
getDelegate
public Pump getDelegate()
-
pump
@Deprecated public static <T> Pump pump(ReadStream<T> rs, WriteStream<T> ws)
Deprecated.Create a newPump
with the givenReadStream
andWriteStream
- Parameters:
rs
- the read streamws
- the write stream- Returns:
- the pump
-
pump
@Deprecated public static <T> Pump pump(io.reactivex.Flowable<T> rs, WriteStream<T> ws)
Deprecated.Create a newPump
with the givenReadStream
andWriteStream
- Parameters:
rs
- the read streamws
- the write stream- Returns:
- the pump
-
pump
@Deprecated public static <T> Pump pump(ReadStream<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
Deprecated.Create a newPump
with the givenReadStream
andWriteStream
andwriteQueueMaxSize
- Parameters:
rs
- the read streamws
- the write streamwriteQueueMaxSize
- the max size of the write queue- Returns:
- the pump
-
pump
@Deprecated public static <T> Pump pump(io.reactivex.Flowable<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
Deprecated.Create a newPump
with the givenReadStream
andWriteStream
andwriteQueueMaxSize
- Parameters:
rs
- the read streamws
- the write streamwriteQueueMaxSize
- the max size of the write queue- Returns:
- the pump
-
setWriteQueueMaxSize
@Deprecated public Pump setWriteQueueMaxSize(int maxSize)
Deprecated.Set the write queue max size tomaxSize
- Parameters:
maxSize
- the max size- Returns:
- a reference to this, so the API can be used fluently
-
start
@Deprecated public Pump start()
Deprecated.Start the Pump. The Pump can be started and stopped multiple times.- Returns:
- a reference to this, so the API can be used fluently
-
stop
@Deprecated public Pump stop()
Deprecated.Stop the Pump. The Pump can be started and stopped multiple times.- Returns:
- a reference to this, so the API can be used fluently
-
numberPumped
@Deprecated public int numberPumped()
Deprecated.Return the total number of items pumped by this pump.- Returns:
-
-