Class: Vertx::TimeoutStream
- Inherits:
-
Object
- Object
- Vertx::TimeoutStream
- Includes:
- ReadStream
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb
Overview
A timeout stream is triggered by a timer, the Proc will be call when the timer is fired,
it can be once or several times depending on the nature of the timer related to this stream. The
will be called after the timer handler has been called.
Pausing the timer inhibits the timer shots until the stream is resumed. Setting a null handler callback cancels the timer.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) cancel
Cancels the timeout.
- - (self) endHandler(endHandler) { ... }
- - (self) exceptionHandler(handler) { ... }
- - (self) fetch(amount)
- - (self) handler(handler) { ... }
- - (self) pause
-
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
-
- (void) pipeTo(dst, handler) { ... }
Pipe this ReadStream to the WriteStream.
- - (self) resume
Class Method Details
+ (Boolean) accept?(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 28 def @@j_api_type.accept?(obj) obj.class == TimeoutStream end |
+ (Object) j_api_type
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 37 def self.j_api_type @@j_api_type end |
+ (Object) j_class
40 41 42 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 40 def self.j_class Java::IoVertxCore::TimeoutStream.java_class end |
+ (Object) unwrap(obj)
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 34 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 31 def @@j_api_type.wrap(obj) TimeoutStream.new(obj) end |
Instance Method Details
- (void) cancel
This method returns an undefined value.
Cancels the timeout. Note this has the same effect as calling #handler with a null argument.
47 48 49 50 51 52 53 54 55 56 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 47 def cancel if !block_given? return @j_del.java_method(:cancel, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling cancel()" end end |
- (self) endHandler(endHandler) { ... }
113 114 115 116 117 118 119 120 121 122 123 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 113 def end_handler if true @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling end_handler()" end end |
- (self) exceptionHandler(handler) { ... }
156 157 158 159 160 161 162 163 164 165 166 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 156 def exception_handler if true @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling exception_handler()" end end |
- (self) fetch(amount)
127 128 129 130 131 132 133 134 135 136 137 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 127 def fetch(*args) if args[0].class == Fixnum && !block_given? @j_del.java_method(:fetch, [Java::long.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling fetch(#{args[0]})" end end |
- (self) handler(handler) { ... }
73 74 75 76 77 78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 73 def handler if true @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling handler()" end end |
- (self) pause
169 170 171 172 173 174 175 176 177 178 179 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 169 def pause if !block_given? @j_del.java_method(:pause, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pause()" end end |
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
The stream will be resumed when the pipe will be wired to a
WriteStream
.
143 144 145 146 147 148 149 150 151 152 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 143 def pipe if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:pipe, []).call(),::Vertx::Pipe, nil) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pipe()" end end |
- (void) pipeTo(dst, handler) { ... }
This method returns an undefined value.
Pipe thisReadStream
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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 94 def pipe_to(*args) if args[0].class.method_defined?(:j_del) && true if (block_given?) return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling pipe_to(#{args[0]})" end end |
- (self) resume
59 60 61 62 63 64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/timeout_stream.rb', line 59 def resume if !block_given? @j_del.java_method(:resume, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling resume()" end end |