@Deprecated public static InputStream getStream(Scriptable scope) { ShellConsole console = ShellConsole.getConsole(scope, Charset.defaultCharset()); return (console != null ? console.getIn() : null); } }
private int readNextLine() throws IOException { String line = console.readLine(null); if (line != null) { buffer = line.getBytes(cs); return buffer.length; } else { buffer = EMPTY; return -1; } } }
if (filename == null) { console.println(cx.getImplementationVersion()); if (filename == null) prompt = prompts[0]; console.flush(); String source = ""; String newline; try { newline = console.readLine(prompt); console.println(ioe.toString()); break; console.println(Context.toString(result)); } catch (RhinoException rex) { ToolErrorReporter.reportException( console.println(); console.flush(); } else if (useRequire && filename.equals(mainModule)) { require.requireMain(cx, filename);
"jline.console.ConsoleReader"); if (readerClass != null) { return getJLineShellConsoleV2(classLoader, readerClass, scope, cs); return getJLineShellConsoleV1(classLoader, readerClass, scope, cs);
private boolean loadJLine(Charset cs) { if (!attemptedJLineLoad) { // Check if we can use JLine for better command line handling attemptedJLineLoad = true; console = ShellConsole.getConsole(this, cs); } return console != null; }
private static JLineShellConsoleV1 getJLineShellConsoleV1( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompletor(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.Completor"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompletor", new Class[] {completorClass}, completor); return new JLineShellConsoleV1(reader, cs); }
public InputStream getIn() { if (inStream == null && !attemptedJLineLoad) { if (loadJLine(Charset.defaultCharset())) { inStream = console.getIn(); } } return inStream == null ? System.in : inStream; }
if (filename == null) { console.println(cx.getImplementationVersion()); if (filename == null) prompt = prompts[0]; console.flush(); String source = ""; String newline; try { newline = console.readLine(prompt); console.println(ioe.toString()); break; console.println(Context.toString(result)); } catch (RhinoException rex) { ToolErrorReporter.reportException( console.println(); console.flush(); } else if (useRequire && filename.equals(mainModule)) { require.requireMain(cx, filename);
"jline.console.ConsoleReader"); if (readerClass != null) { return getJLineShellConsoleV2(classLoader, readerClass, scope, cs); return getJLineShellConsoleV1(classLoader, readerClass, scope, cs);
private boolean loadJLine(Charset cs) { if (!attemptedJLineLoad) { // Check if we can use JLine for better command line handling attemptedJLineLoad = true; console = ShellConsole.getConsole(this, cs); } return console != null; }
private static JLineShellConsoleV1 getJLineShellConsoleV1( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompletor(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.Completor"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompletor", new Class[] {completorClass}, completor); return new JLineShellConsoleV1(reader, cs); }
public InputStream getIn() { if (inStream == null && !attemptedJLineLoad) { if (loadJLine(Charset.defaultCharset())) { inStream = console.getIn(); } } return inStream == null ? System.in : inStream; }
@Deprecated public static InputStream getStream(Scriptable scope) { ShellConsole console = ShellConsole.getConsole(scope, Charset.defaultCharset()); return (console != null ? console.getIn() : null); } }
public ShellConsole getConsole(Charset cs) { if (!loadJLine(cs)) { console = ShellConsole.getConsole(getIn(), getErr(), cs); } return console; }
private static JLineShellConsoleV2 getJLineShellConsoleV2( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompleter(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.console.completer.Completer"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompleter", new Class[] {completorClass}, completor); return new JLineShellConsoleV2(reader, cs); } }
private int readNextLine() throws IOException { String line = console.readLine(null); if (line != null) { buffer = line.getBytes(cs); return buffer.length; } else { buffer = EMPTY; return -1; } } }
public ShellConsole getConsole(Charset cs) { if (!loadJLine(cs)) { console = ShellConsole.getConsole(getIn(), getErr(), cs); } return console; }
private static JLineShellConsoleV2 getJLineShellConsoleV2( ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { // ConsoleReader reader = new ConsoleReader(); Constructor<?> c = readerClass.getConstructor(); Object reader = c.newInstance(); // reader.setBellEnabled(false); tryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, Boolean.FALSE); // reader.addCompleter(new FlexibleCompletor(prefixes)); Class<?> completorClass = Kit.classOrNull(classLoader, "jline.console.completer.Completer"); Object completor = Proxy.newProxyInstance(classLoader, new Class[] { completorClass }, new FlexibleCompletor(completorClass, scope)); tryInvoke(reader, "addCompleter", new Class[] {completorClass}, completor); return new JLineShellConsoleV2(reader, cs); } }