Class: SystemUniversal::StreamReader

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

Instance Method Summary collapse

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

#joinObject



318
319
320
321
# File 'lib/systemu.rb', line 318

def join
  @thread.join
  @data
end