Class: Croaky::Stream::JavaStdErrStream

Inherits:
StdErrStream show all
Defined in:
lib/croaky/stream/java_std_err_stream.rb

Overview

Error stream for Java

Instance Attribute Summary collapse

Attributes inherited from StdErrStream

#stderr_str_io

Instance Method Summary collapse

Instance Attribute Details

#java_stderrObject

Returns the value of attribute java_stderr.



9
10
11
# File 'lib/croaky/stream/java_std_err_stream.rb', line 9

def java_stderr
  @java_stderr
end

#pw_errObject

Returns the value of attribute pw_err.



9
10
11
# File 'lib/croaky/stream/java_std_err_stream.rb', line 9

def pw_err
  @pw_err
end

Instance Method Details

#capture_ioObject



11
12
13
14
15
16
17
18
# 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_ioObject



27
28
29
30
31
# File 'lib/croaky/stream/java_std_err_stream.rb', line 27

def read_captured_io
  captured = super

  captured << read_err_stream
end

#restore_ioObject



20
21
22
23
24
25
# 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