Class: SystemUniversal::StreamReader
Instance Method Summary collapse
-
#initialize(stream) ⇒ StreamReader
constructor
A new instance of StreamReader.
- #join ⇒ Object
Constructor Details
#initialize(stream) ⇒ StreamReader
Returns a new instance of StreamReader.
307 308 309 310 311 312 313 314 315 316 |
# File 'lib/systemu.rb', line 307 def initialize(stream) @data = "" @thread = Thread.new do reader = java.io.BufferedReader.new java.io.InputStreamReader.new(stream) while line = reader.read_line @data << line << "\n" end end end |
Instance Method Details
#join ⇒ Object
318 319 320 321 |
# File 'lib/systemu.rb', line 318 def join @thread.join @data end |