Only use a single instance for getting an input stream
This commit is contained in:
parent
b499056eeb
commit
d2bde53217
|
@ -73,6 +73,19 @@ public class InputConsole {
|
||||||
return new String(line);
|
return new String(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static InputStream wrappedInputStream = new InputStream() {
|
||||||
|
@Override
|
||||||
|
public int read() throws IOException {
|
||||||
|
return consoleProxyReader.read0();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
consoleProxyReader.release0();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** return -1 if no data */
|
/** return -1 if no data */
|
||||||
public static final int read() {
|
public static final int read() {
|
||||||
return consoleProxyReader.read0();
|
return consoleProxyReader.read0();
|
||||||
|
@ -84,17 +97,7 @@ public class InputConsole {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InputStream getInputStream() {
|
public static InputStream getInputStream() {
|
||||||
return new InputStream() {
|
return wrappedInputStream;
|
||||||
@Override
|
|
||||||
public int read() throws IOException {
|
|
||||||
return consoleProxyReader.read0();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() throws IOException {
|
|
||||||
consoleProxyReader.release0();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void echo(boolean enableEcho) {
|
public static void echo(boolean enableEcho) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user