if (outStream != null) {
stream = new FilterOutputStream(outStream);
} else if (outSocket != null) {
stream = new FilterOutputStream(outSocket.getOutputStream());
} else {
IOContext ioContext = VmIsolate.getRoot().getIOContext();
stream = new FilterOutputStream(ioContext.getRealSystemOut());
}
return new PrintStream(stream);
}