Class: SystemUniversal::StreamReader
- Defined in:
- lib/flustered/vendored_systemu.rb
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.
285 286 287 288 289 290 291 292 293 294 |
# File 'lib/flustered/vendored_systemu.rb', line 285 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
296 297 298 299 |
# File 'lib/flustered/vendored_systemu.rb', line 296 def join @thread.join @data end |