Class ReadStream.ReadStreamImpl<T>
- All Implemented Interfaces:
MutinyDelegate,ReadStream<T>,StreamBase
- Enclosing interface:
- ReadStream<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.ReadStream
ReadStream.ReadStreamImpl<T>Nested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.StreamBase
StreamBase.StreamBaseImpl -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReadStreamImpl(io.vertx.core.streams.ReadStream<T> delegate) Create a new instance ofReadStream.ReadStreamImpldelegating to the given (non-null) instance ofReadStream.ReadStreamImpl(io.vertx.core.streams.ReadStream<T> delegate, TypeArg<T> typeArg_0) -
Method Summary
Modifier and TypeMethodDescriptionendHandler(Runnable endHandler) Set an end handler.exceptionHandler(Consumer<Throwable> handler) Set an exception handler on the read stream.fetch(long amount) Fetch the specifiedamountof elements.io.vertx.core.streams.ReadStream<T>Get the delegate instance.Set a data handler.pause()Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.pipe()Pause this stream and return aPipeto transfer the elements of this stream to a destinationWriteStream.io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<T> dst) Pipe thisReadStreamto theWriteStream.voidpipeToAndAwait(WriteStream<T> dst) Pipe thisReadStreamto theWriteStream.pipeToAndForget(WriteStream<T> dst) Pipe thisReadStreamto theWriteStream.resume()Resume reading, and sets the buffer inflowingmode.
-
Field Details
-
__typeArg_0
-
-
Constructor Details
-
ReadStreamImpl
Create a new instance ofReadStream.ReadStreamImpldelegating to the given (non-null) instance ofReadStream. -
ReadStreamImpl
-
-
Method Details
-
getDelegate
Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceReadStream<T>- Specified by:
getDelegatein interfaceStreamBase- Returns:
- the delegate instance
-
pipeTo
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Specified by:
pipeToin interfaceReadStream<T>- Parameters:
dst- the destination write stream- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.core.streams.ReadStream#pipeTo(WriteStream)
-
pipeToAndAwait
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
dst- the destination write stream- See Also:
-
io.vertx.core.streams.ReadStream#pipeTo(WriteStream)
-
pipeToAndForget
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
dst- the destination write stream- Returns:
- The current instance to chain operations if needed.
- See Also:
-
io.vertx.core.streams.ReadStream#pipeTo(WriteStream)
-
exceptionHandler
Set an exception handler on the read stream.- Specified by:
exceptionHandlerin interfaceReadStream<T>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
handler
Set a data handler. As data is read, the handler will be called with the data.- Specified by:
handlerin interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
pause
Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data
handler.- Specified by:
pausein interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
resume
Resume reading, and sets the buffer inflowingmode. If theReadStreamhas been paused, reading will recommence on it.- Specified by:
resumein interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
Fetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
fetchin interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
- Throws:
when- the amount is a negative value
-
endHandler
Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.- Specified by:
endHandlerin interfaceReadStream<T>- Returns:
- a reference to this, so the API can be used fluently
-
pipe
Pause this stream and return aPipeto transfer the elements of this stream to a destinationWriteStream. The stream will be resumed when the pipe will be wired to aWriteStream.- Specified by:
pipein interfaceReadStream<T>- Returns:
- a pipe
-