34 LOGGER.enable_library_import_logging()
37 def __exit__(self, exc_type, exc_value, exc_trace):
40 LOGGER.disable_library_import_logging()
44 stdout, stderr = self.
_release_release()
46 LOGGER.log_output(stdout)
48 LOGGER.log_output(stderr)
49 sys.__stderr__.write(
console_encode(stderr, stream=sys.__stderr__))
91 return stream.getvalue()
99 stream.write =
lambda s:
None
100 stream.flush =
lambda:
None
115 from java.io
import ByteArrayOutputStream, PrintStream
116 from java.lang
import System
127 self.
_bytes_bytes = ByteArrayOutputStream()
135 output = self.
_bytes_bytes.toString(
'UTF-8')
def __init__(self, stdout=True)
def _release_and_log(self)
def __exit__(self, exc_type, exc_value, exc_trace)
def __init__(self, library_import=False)
def _set_stdout(self, stream)
def _get_value(self, stream)
def _avoid_at_exit_errors(self, stream)
def __init__(self, stdout=True)
def _set_stderr(self, stream)
def console_decode(string, encoding=CONSOLE_ENCODING, force=False)
Decodes bytes from console encoding to Unicode.
def console_encode(string, errors='replace', stream=sys.__stdout__)
Encodes Unicode to bytes in console or system encoding.