Class ShellConsole
java.lang.Object
org.mozilla.javascript.tools.shell.ShellConsole
- Direct Known Subclasses:
ShellConsole.JLineShellConsoleV1, ShellConsole.JLineShellConsoleV2, ShellConsole.SimpleShellConsole
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
JLine's ConsoleReaderInputStream is no longer public, therefore we need to use our own implementationprivate static class
ShellConsole
implementation for JLine v1private static class
ShellConsole
implementation for JLine v2private static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
flush()
Flushes the console's outputstatic ShellConsole
getConsole
(InputStream in, PrintStream ps, Charset cs) static ShellConsole
getConsole
(Scriptable scope, Charset cs) Provides a specializedShellConsole
to handle line editing, history and completion.abstract InputStream
getIn()
Returns the underlyingInputStream
private static ShellConsole.JLineShellConsoleV1
getJLineShellConsoleV1
(ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) private static ShellConsole.JLineShellConsoleV2
getJLineShellConsoleV2
(ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) abstract void
Prints a single string to the consoleabstract void
println()
Prints the newline character-sequence to the consoleabstract void
Prints a string and the newline character-sequence to the consoleabstract String
readLine()
Reads a single line from the consoleabstract String
Reads a single line from the console and sets the console's prompt toprompt
private static Object
-
Field Details
-
NO_ARG
-
BOOLEAN_ARG
-
STRING_ARG
-
CHARSEQ_ARG
-
-
Constructor Details
-
ShellConsole
protected ShellConsole()
-
-
Method Details
-
getIn
Returns the underlyingInputStream
-
readLine
Reads a single line from the console- Throws:
IOException
-
readLine
Reads a single line from the console and sets the console's prompt toprompt
- Throws:
IOException
-
flush
-
print
Prints a single string to the console- Throws:
IOException
-
println
Prints the newline character-sequence to the console- Throws:
IOException
-
println
Prints a string and the newline character-sequence to the console- Throws:
IOException
-
tryInvoke
-
getConsole
-
getConsole
Provides a specializedShellConsole
to handle line editing, history and completion. Relies on the JLine library (see http://jline.sourceforge.net). -
getJLineShellConsoleV1
private static ShellConsole.JLineShellConsoleV1 getJLineShellConsoleV1(ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException -
getJLineShellConsoleV2
private static ShellConsole.JLineShellConsoleV2 getJLineShellConsoleV2(ClassLoader classLoader, Class<?> readerClass, Scriptable scope, Charset cs) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
-