mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8295803: Console should be usable in jshell and other environments
Reviewed-by: jlaskey, alanb
This commit is contained in:
parent
5d4c71c8bd
commit
8a9911ef17
17 changed files with 673 additions and 23 deletions
|
@ -189,6 +189,9 @@ public final class System {
|
|||
*/
|
||||
public static final PrintStream err = null;
|
||||
|
||||
// Holder for the initial value of `in`, set within `initPhase1()`.
|
||||
private static InputStream initialIn;
|
||||
|
||||
// indicates if a security manager is possible
|
||||
private static final int NEVER = 1;
|
||||
private static final int MAYBE = 2;
|
||||
|
@ -2174,7 +2177,8 @@ public final class System {
|
|||
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
|
||||
FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
|
||||
FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
|
||||
setIn0(new BufferedInputStream(fdIn));
|
||||
initialIn = new BufferedInputStream(fdIn);
|
||||
setIn0(initialIn);
|
||||
// stdout/err.encoding are set when the VM is associated with the terminal,
|
||||
// thus they are equivalent to Console.charset(), otherwise the encodings
|
||||
// of those properties default to native.encoding
|
||||
|
@ -2485,6 +2489,10 @@ public final class System {
|
|||
return StringCoding.implEncodeAsciiArray(src, srcOff, dst, dstOff, len);
|
||||
}
|
||||
|
||||
public InputStream initialSystemIn() {
|
||||
return initialIn;
|
||||
}
|
||||
|
||||
public void setCause(Throwable t, Throwable cause) {
|
||||
t.setCause(cause);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue