Update terminal file

This commit is contained in:
Arne Keller 2020-03-17 12:23:50 +01:00
parent 477b45c42b
commit 2ab56c21ee

View File

@ -24,11 +24,7 @@ public final class Terminal {
* of characters, arrays, and lines. This stream is already open and ready to supply input data and corresponds * of characters, arrays, and lines. This stream is already open and ready to supply input data and corresponds
* to keyboard input. * to keyboard input.
*/ */
private static BufferedReader IN = new BufferedReader(new InputStreamReader(System.in)); private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void reload() {
IN = new BufferedReader(new InputStreamReader(System.in));
}
/** /**
* Private constructor to avoid object generation. * Private constructor to avoid object generation.
@ -68,6 +64,13 @@ public final class Terminal {
System.out.println(object); System.out.println(object);
} }
/**
* xx.
*/
public static void reload() {
in = new BufferedReader(new InputStreamReader(System.in));
}
/** /**
* Prints an array of characters and then terminate the line. * Prints an array of characters and then terminate the line.
* *
@ -97,9 +100,9 @@ public final class Terminal {
*/ */
public static String readLine() { public static String readLine() {
try { try {
String line = IN.readLine(); String line = in.readLine();
while (line != null && line.startsWith("#")) { while (line != null && line.startsWith("#")) {
line = IN.readLine(); line = in.readLine();
} }
if (line == null) { if (line == null) {
return "quit"; return "quit";