Package io.vertx.mutiny.core.streams
Interface ReadStream<T>
-
- All Superinterfaces:
StreamBase
- All Known Subinterfaces:
WebSocketBase
- All Known Implementing Classes:
AsyncFile,DatagramSocket,HttpClientRequest,HttpClientResponse,HttpServerFileUpload,HttpServerRequest,JsonParser,MessageConsumer,NetSocket,RecordParser,ServerWebSocket,TimeoutStream,WebSocket
public interface ReadStream<T> extends StreamBase
Represents a stream of items that can be read from.Any class that implements this interface can be used by a
Pumpto pump data from it to aWriteStream.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()andfetch(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
originalnon Mutiny-ified interface using Vert.x codegen.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description ReadStream<T>endHandler(Consumer<Void> endHandler)ReadStream<T>exceptionHandler(Consumer<Throwable> handler)ReadStream<T>fetch(long amount)io.vertx.core.streams.ReadStreamgetDelegate()ReadStream<T>handler(Consumer<T> handler)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)ReadStream<T>pause()Pipe<T>pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<T> dst)Pipe thisReadStreamto theWriteStream.VoidpipeToAndAwait(WriteStream<T> dst)Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream.) ReadStream<T>resume()io.smallrye.mutiny.Multi<T>toMulti()
-
-
-
Method Detail
-
getDelegate
io.vertx.core.streams.ReadStream getDelegate()
- Specified by:
getDelegatein interfaceStreamBase
-
toMulti
io.smallrye.mutiny.Multi<T> toMulti()
-
exceptionHandler
ReadStream<T> exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
ReadStream<T> handler(Consumer<T> handler)
- Parameters:
handler-- Returns:
- a reference to this, so the API can be used fluently
-
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
ReadStream<T> fetch(long amount)
- Parameters:
amount-- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
ReadStream<T> endHandler(Consumer<Void> endHandler)
- Parameters:
endHandler-- Returns:
- a reference to this, so the API can be used fluently
-
pipeTo
io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<T> dst)
Pipe thisReadStreamto 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
handlerwill 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
unifiring the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
Void pipeToAndAwait(WriteStream<T> dst)
Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(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
-
newInstance
static <T> ReadStream<T> newInstance(io.vertx.core.streams.ReadStream arg)
-
newInstance
static <T> ReadStream<T> newInstance(io.vertx.core.streams.ReadStream arg, TypeArg<T> __typeArg_T)
-
-