Module: Vertx::ReadStream
- Included in:
- AsyncFile, HttpClientResponse, HttpServerFileUpload, HttpServerRequest, NetSocket, SockJSSocket, WebSocket
- Defined in:
- src/main/api_shim/core/streams.rb
Overview
A mixin module which represents a stream of data that can be read from.
Any class that mixes in this module can be used by a Pump to pump data from a ReadStream to it.
Instance Method Summary (collapse)
-
- (Object) data_handler(&hndlr)
Set a data handler.
-
- (Object) end_handler(&hndlr)
Set an end handler on the stream.
-
- (Object) exception_handler(&hndlr)
Set an execption handler on the stream.
-
- (Object) pause
Pause the ReadStream.
-
- (Object) resume
Resume reading.
Instance Method Details
- (Object) data_handler(&hndlr)
Set a data handler. As data is read, the handler will be called with the data.
84 85 86 87 88 89 |
# File 'src/main/api_shim/core/streams.rb', line 84 def data_handler(&hndlr) @j_del.dataHandler(Proc.new { |j_buff| hndlr.call(Buffer.new(j_buff)) }) self end |
- (Object) end_handler(&hndlr)
Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
112 113 114 115 |
# File 'src/main/api_shim/core/streams.rb', line 112 def end_handler(&hndlr) @j_del.endHandler(hndlr) self end |
- (Object) exception_handler(&hndlr)
Set an execption handler on the stream.
105 106 107 108 |
# File 'src/main/api_shim/core/streams.rb', line 105 def exception_handler(&hndlr) @j_del.exceptionHandler(hndlr) self end |
- (Object) pause
Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the #data_handler
92 93 94 95 |
# File 'src/main/api_shim/core/streams.rb', line 92 def pause @j_del.pause self end |
- (Object) resume
Resume reading. If the ReadStream has been paused, reading will recommence on it.
98 99 100 101 |
# File 'src/main/api_shim/core/streams.rb', line 98 def resume @j_del.resume self end |