public interface ReadStream<T> extends StreamBase
Any class that implements this interface can be used by a Pipe
to pipe data from it
to a WriteStream
.
handler
.handler
.pause()
, resume()
and fetch(long)
methods:
resume()
sets the flowing modepause()
sets the fetch mode and resets the demand to 0
fetch(long)
requests a specific amount of elements and adds it to the actual demandModifier and Type | Method and Description |
---|---|
ReadStream<T> |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
ReadStream<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
ReadStream<T> |
fetch(long amount)
Fetch the specified
amount of elements. |
ReadStream<T> |
handler(Handler<T> handler)
Set a data handler.
|
ReadStream<T> |
pause()
Pause the
ReadStream , it sets the buffer in fetch mode and clears the actual demand. |
default Pipe<T> |
pipe()
Pause this stream and return a
Pipe to transfer the elements of this stream to a destination WriteStream . |
default Future<Void> |
pipeTo(WriteStream<T> dst)
Same as
pipeTo(WriteStream, Handler) but returns a Future of the asynchronous result |
default void |
pipeTo(WriteStream<T> dst,
Handler<AsyncResult<Void>> handler)
Pipe this
ReadStream to the WriteStream . |
ReadStream<T> |
resume()
Resume reading, and sets the buffer in
flowing mode. |
ReadStream<T> exceptionHandler(Handler<Throwable> handler)
exceptionHandler
in interface StreamBase
handler
- the exception handlerReadStream<T> handler(Handler<T> handler)
ReadStream<T> pause()
ReadStream
, it sets the buffer in fetch
mode and clears the actual demand.
While it's paused, no data will be sent to the data handler
.
ReadStream<T> resume()
flowing
mode.
If the ReadStream
has been paused, reading will recommence on it.ReadStream<T> fetch(long amount)
amount
of elements. If the ReadStream
has been paused, reading will
recommence with the specified amount
of items, otherwise the specified amount
will
be added to the current stream demand.ReadStream<T> endHandler(Handler<Void> endHandler)
default Pipe<T> pipe()
Pipe
to transfer the elements of this stream to a destination WriteStream
.
The stream will be resumed when the pipe will be wired to a WriteStream
.default Future<Void> pipeTo(WriteStream<T> dst)
pipeTo(WriteStream, Handler)
but returns a Future
of the asynchronous resultdefault void pipeTo(WriteStream<T> dst, Handler<AsyncResult<Void>> handler)
ReadStream
to the WriteStream
.
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.
dst
- the destination write streamCopyright © 2024 Eclipse. All rights reserved.