Interface ReadStream<T>

    • Method Detail

      • exceptionHandler

        ReadStream<T> exceptionHandler​(Handler<Throwable> handler)
        Set an exception handler on the read stream.
        Specified by:
        exceptionHandler in interface StreamBase
        Parameters:
        handler - the exception handler
        Returns:
        a reference to this, so the API can be used fluently
      • handler

        ReadStream<T> handler​(Handler<T> handler)
        Set a data handler. As data is read, the handler will be called with the data.
        Parameters:
        handler -
        Returns:
        a reference to this, so the API can be used fluently
      • pause

        ReadStream<T> pause()
        Pause the 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.

        Returns:
        a reference to this, so the API can be used fluently
      • resume

        ReadStream<T> resume()
        Resume reading, and sets the buffer in flowing mode.

        If the ReadStream has been paused, reading will recommence on it.

        Returns:
        a reference to this, so the API can be used fluently
      • fetch

        ReadStream<T> fetch​(long amount)
        Fetch the specified 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.
        Parameters:
        amount -
        Returns:
        a reference to this, so the API can be used fluently
      • endHandler

        ReadStream<T> endHandler​(Handler<Void> endHandler)
        Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
        Parameters:
        endHandler -
        Returns:
        a reference to this, so the API can be used fluently
      • pipe

        Pipe<T> pipe()
        Pause this stream and return a 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.

        Returns:
        a pipe
      • pipeTo

        void pipeTo​(WriteStream<T> dst,
                    Handler<AsyncResult<Void>> handler)
        Pipe this 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.

        Parameters:
        dst - the destination write stream
        handler -
      • pipeTo

        void pipeTo​(WriteStream<T> dst)
        Pipe this 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.

        Parameters:
        dst - the destination write stream
      • rxPipeTo

        io.reactivex.Completable rxPipeTo​(WriteStream<T> dst)
        Pipe this 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.

        Parameters:
        dst - the destination write stream
        Returns:
      • toObservable

        io.reactivex.Observable<T> toObservable()
      • toFlowable

        io.reactivex.Flowable<T> toFlowable()