Interface ReadStream<T>
- All Superinterfaces:
MutinyDelegate
,StreamBase
- All Known Subinterfaces:
WebSocketBase
- All Known Implementing Classes:
AmqpReceiver
,AsyncFile
,CassandraRowStream
,ClientWebSocket
,DatagramSocket
,HttpClientResponse
,HttpServerFileUpload
,HttpServerRequest
,JsonParser
,KafkaConsumer
,MessageConsumer
,NetSocket
,PgChannel
,RabbitMQConsumer
,RecordParser
,RedisConnection
,RowStream
,ServerWebSocket
,SockJSSocket
,SQLRowStream
,TimeoutStream
,WebSocket
Any class that implements this interface can be used by a Pipe
to pipe data from it
to a WriteStream
.
Streaming mode
The stream is either in flowing or fetch mode.-
Initially the stream is in flowing mode.
- When the stream is in flowing mode, elements are delivered to the
handler
. - When the stream is in fetch mode, only the number of requested elements will be delivered to the
handler
.
pause()
, resume()
and fetch(long)
methods:
- Calling
resume()
sets the flowing mode - Calling
pause()
sets the fetch mode and resets the demand to0
- Calling
fetch(long)
requests a specific amount of elements and adds it to the actual demand
original
non Mutiny-ified interface using Vert.x codegen.-
Method Summary
Modifier and TypeMethodDescriptionendHandler
(Runnable endHandler) exceptionHandler
(Consumer<Throwable> handler) fetch
(long amount) io.vertx.core.streams.ReadStream
static <T> ReadStream<T>
newInstance
(io.vertx.core.streams.ReadStream arg) static <T> ReadStream<T>
newInstance
(io.vertx.core.streams.ReadStream arg, TypeArg<T> __typeArg_T) pause()
pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo
(WriteStream<T> dst) Pipe thisReadStream
to theWriteStream
.pipeToAndAwait
(WriteStream<T> dst) Blocking variant ofpipeTo(io.vertx.mutiny.core.streams.WriteStream)
.void
pipeToAndForget
(WriteStream<T> dst) Variant ofpipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.resume()
io.smallrye.mutiny.Multi<T>
toMulti()
-
Method Details
-
getDelegate
io.vertx.core.streams.ReadStream getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Specified by:
getDelegate
in interfaceStreamBase
- Returns:
- the delegate used by this Mutiny object of generated type
-
toMulti
-
exceptionHandler
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
handler
- Parameters:
handler
-- Returns:
-
pause
ReadStream<T> pause()- Returns:
- a reference to this, so the API can be used fluently
-
resume
ReadStream<T> resume()- Returns:
- a reference to this, so the API can be used fluently
-
fetch
- Parameters:
amount
-- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
- Parameters:
endHandler
-- Returns:
-
pipe
- Returns:
- a pipe
-
pipeTo
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handler
will be called with the result.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
Blocking variant ofpipeTo(io.vertx.mutiny.core.streams.WriteStream)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
Variant ofpipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.This method subscribes on the result of
pipeTo(io.vertx.mutiny.core.streams.WriteStream)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompipeTo(io.vertx.mutiny.core.streams.WriteStream)
but you don't need to compose it with other operations.- Parameters:
dst
- the destination write stream
-
newInstance
-
newInstance
-