Class: SystemUniversal::StreamReader

Inherits:
Object
  • Object
show all
Defined in:
lib/flustered/vendored_systemu.rb

Instance Method Summary collapse

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

#joinObject



296
297
298
299
# File 'lib/flustered/vendored_systemu.rb', line 296

def join
  @thread.join
  @data
end