Module: Vertx::ReadStream
- Included in:
- HttpClientResponse, HttpServerRequest, NetSocket, SockJSSocket, WebSocket
- Defined in:
- src/main/ruby_scripts/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(proc = nil, &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(proc = nil, &hndlr)
Set a data handler. As data is read, the handler will be called with the data.
75 76 77 78 79 80 |
# File 'src/main/ruby_scripts/core/streams.rb', line 75 def data_handler(proc = nil, &hndlr) hndlr = proc if proc @j_del.dataHandler(Proc.new { |j_buff| hndlr.call(Buffer.new(j_buff)) }) 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.
100 101 102 |
# File 'src/main/ruby_scripts/core/streams.rb', line 100 def end_handler(&hndlr) @j_del.endHandler(hndlr) end |
- (Object) exception_handler(&hndlr)
Set an execption handler on the stream.
94 95 96 |
# File 'src/main/ruby_scripts/core/streams.rb', line 94 def exception_handler(&hndlr) @j_del.exceptionHandler(hndlr) end |
- (Object) pause
Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the #data_handler
83 84 85 |
# File 'src/main/ruby_scripts/core/streams.rb', line 83 def pause @j_del.pause end |
- (Object) resume
Resume reading. If the ReadStream has been paused, reading will recommence on it.
88 89 90 |
# File 'src/main/ruby_scripts/core/streams.rb', line 88 def resume @j_del.resume end |