Class: ReadStream

vertx-js/read_stream~ ReadStream

new ReadStream()

Represents a stream of items that can be read from.

Source:

Methods

endHandler(endHandler) → {ReadStream}

Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
Parameters:
Name Type Description
endHandler function
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

exceptionHandler(handler) → {ReadStream}

Set an exception handler on the read stream.
Parameters:
Name Type Description
handler function the exception handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

fetch(amount) → {ReadStream}

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:
Name Type Description
amount number
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

handler(handler) → {ReadStream}

Set a data handler. As data is read, the handler will be called with the data.
Parameters:
Name Type Description
handler function
Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

pause() → {ReadStream}

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.

Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream

pipe() → {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.

Source:
Returns:
a pipe
Type
Pipe

pipeTo(dst, 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:
Name Type Description
dst WriteStream the destination write stream
handler function
Source:

resume() → {ReadStream}

Resume reading, and sets the buffer in flowing mode.

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

Source:
Returns:
a reference to this, so the API can be used fluently
Type
ReadStream