< prev index next >
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
Print this page
rev 3613 : imported patch 8131023
*** 24,34 ****
*/
package jdk.internal.jshell.tool;
import java.io.BufferedWriter;
- import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
--- 24,33 ----
*** 151,167 ****
* @param prefs preferences to use
* @param locale locale to use
*/
public JShellTool(InputStream cmdin, PrintStream cmdout, PrintStream cmderr,
PrintStream console,
! InputStream userin, PrintStream userout, PrintStream usererr,
Preferences prefs, Locale locale) {
this.cmdin = cmdin;
this.cmdout = cmdout;
this.cmderr = cmderr;
this.console = console;
! this.userin = userin;
this.userout = userout;
this.usererr = usererr;
this.prefs = prefs;
this.locale = locale;
}
--- 150,171 ----
* @param prefs preferences to use
* @param locale locale to use
*/
public JShellTool(InputStream cmdin, PrintStream cmdout, PrintStream cmderr,
PrintStream console,
! PrintStream userout, PrintStream usererr,
Preferences prefs, Locale locale) {
this.cmdin = cmdin;
this.cmdout = cmdout;
this.cmderr = cmderr;
this.console = console;
! this.userin = new InputStream() {
! @Override
! public int read() throws IOException {
! return input.readUserInput();
! }
! };
this.userout = userout;
this.usererr = usererr;
this.prefs = prefs;
this.locale = locale;
}
*** 448,458 ****
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
new JShellTool(System.in, System.out, System.err, System.out,
! new ByteArrayInputStream(new byte[0]), System.out, System.err,
Preferences.userRoot().node("tool/JShell"),
Locale.getDefault())
.start(args);
}
--- 452,462 ----
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
new JShellTool(System.in, System.out, System.err, System.out,
! System.out, System.err,
Preferences.userRoot().node("tool/JShell"),
Locale.getDefault())
.start(args);
}
*** 2564,2573 ****
--- 2568,2582 ----
@Override
public void close() {
scannerIn.close();
}
+
+ @Override
+ public int readUserInput() {
+ return -1;
+ }
}
class FileScannerIOContext extends ScannerIOContext {
FileScannerIOContext(String fn) throws FileNotFoundException {
*** 2602,2607 ****
--- 2611,2621 ----
}
@Override
public void close() {
}
+
+ @Override
+ public int readUserInput() {
+ return -1;
+ }
}
< prev index next >