class Croaky::Stream::JavaStdErrStream

Error stream for Java

Attributes

java_stderr[RW]
pw_err[RW]

Public Instance Methods

capture_io() click to toggle source
Calls superclass method
# File lib/croaky/stream/java_std_err_stream.rb, line 11
def capture_io
  super

  self.java_stderr = java.lang.System.err
  pw_err&.close
  self.pw_err = err_stream
  java.lang.System.setErr(pw_err)
end
read_captured_io() click to toggle source
Calls superclass method
# File lib/croaky/stream/java_std_err_stream.rb, line 27
def read_captured_io
  captured = super

  captured << read_err_stream
end
restore_io() click to toggle source
Calls superclass method
# File lib/croaky/stream/java_std_err_stream.rb, line 20
def restore_io
  super

  java.lang.System.setErr(java_stderr)
  pw_err.close
end

Private Instance Methods

err_stream() click to toggle source
# File lib/croaky/stream/java_std_err_stream.rb, line 35
def err_stream
  @err_stream = java.io.ByteArrayOutputStream.new
  java.io.PrintStream.new(@err_stream)
end
read_err_stream() click to toggle source
# File lib/croaky/stream/java_std_err_stream.rb, line 40
def read_err_stream
  @err_stream.to_string('utf-8')
end