+
+ String std = """
+ /open DEFAULT
+ import jdk.jshell.spi.ExecutionEnv;
+ import java.util.function.*;
+
+ /** Redirected standard IO. */
+ public class Std {
+ final static InputStream in = new Supplier<InputStream>() {
+
+ @Override
+ public InputStream get() {
+ return ((ExecutionEnv) getClass().getClassLoader()).userIn();
+ }
+
+ }.get();
+ final static PrintStream out = new Supplier<PrintStream>() {
+
+ @Override
+ public PrintStream get() {
+ return ((ExecutionEnv) getClass().getClassLoader()).userOut();
+ }
+
+ }.get();
+ final static PrintStream err = new Supplier<PrintStream>() {
+
+ @Override
+ public PrintStream get() {
+ return ((ExecutionEnv) getClass().getClassLoader()).userErr();
+ }
+
+ }.get();
+
+ }
+ """;
+ writer.write(std);