Class Pump
- java.lang.Object
-
- io.vertx.mutiny.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 Mutiny-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)
io.vertx.core.streams.Pump
getDelegate()
int
hashCode()
static Pump
newInstance(io.vertx.core.streams.Pump arg)
int
numberPumped()
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.static <T> Pump
pump(Flow.Publisher<T> rs, WriteStream<T> ws)
Deprecated.static <T> Pump
pump(Flow.Publisher<T> rs, WriteStream<T> ws, int writeQueueMaxSize)
Deprecated.Pump
setWriteQueueMaxSize(int maxSize)
Deprecated.Pump
start()
Deprecated.Pump
stop()
Deprecated.String
toString()
-
-
-
Constructor Detail
-
Pump
public Pump(io.vertx.core.streams.Pump delegate)
-
Pump
public Pump(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.streams.Pump getDelegate()
-
pump
@Deprecated public static <T> Pump pump(ReadStream<T> rs, WriteStream<T> ws)
Deprecated.- Parameters:
rs
- the read streamws
- 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 streamws
- 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 streamws
- the write streamwriteQueueMaxSize
- 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 streamws
- the write streamwriteQueueMaxSize
- 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)
-
-