Class ShellConsole
- java.lang.Object
-
- org.htmlunit.corejs.javascript.tools.shell.ShellConsole
-
- Direct Known Subclasses:
ShellConsole.JLineShellConsoleV1,ShellConsole.JLineShellConsoleV2,ShellConsole.SimpleShellConsole
public abstract class ShellConsole extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classShellConsole.ConsoleInputStreamJLine's ConsoleReaderInputStream is no longer public, therefore we need to use our own implementationprivate static classShellConsole.JLineShellConsoleV1ShellConsoleimplementation for JLine v1private static classShellConsole.JLineShellConsoleV2ShellConsoleimplementation for JLine v2private static classShellConsole.SimpleShellConsole
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class[]BOOLEAN_ARGprivate static java.lang.Class[]CHARSEQ_ARGprivate static java.lang.Class[]NO_ARGprivate static java.lang.Class[]STRING_ARG
-
Constructor Summary
Constructors Modifier Constructor Description protectedShellConsole()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidflush()Flushes the console's outputstatic ShellConsolegetConsole(java.io.InputStream in, java.io.PrintStream ps, java.nio.charset.Charset cs)static ShellConsolegetConsole(Scriptable scope, java.nio.charset.Charset cs)Provides a specializedShellConsoleto handle line editing, history and completion.abstract java.io.InputStreamgetIn()Returns the underlyingInputStreamprivate static ShellConsole.JLineShellConsoleV1getJLineShellConsoleV1(java.lang.ClassLoader classLoader, java.lang.Class<?> readerClass, Scriptable scope, java.nio.charset.Charset cs)private static ShellConsole.JLineShellConsoleV2getJLineShellConsoleV2(java.lang.ClassLoader classLoader, java.lang.Class<?> readerClass, Scriptable scope, java.nio.charset.Charset cs)abstract voidprint(java.lang.String s)Prints a single string to the consoleabstract voidprintln()Prints the newline character-sequence to the consoleabstract voidprintln(java.lang.String s)Prints a string and the newline character-sequence to the consoleabstract java.lang.StringreadLine()Reads a single line from the consoleabstract java.lang.StringreadLine(java.lang.String prompt)Reads a single line from the console and sets the console's prompt topromptprivate static java.lang.ObjecttryInvoke(java.lang.Object obj, java.lang.String method, java.lang.Class[] paramTypes, java.lang.Object... args)
-
-
-
Method Detail
-
getIn
public abstract java.io.InputStream getIn()
Returns the underlyingInputStream
-
readLine
public abstract java.lang.String readLine() throws java.io.IOExceptionReads a single line from the console- Throws:
java.io.IOException
-
readLine
public abstract java.lang.String readLine(java.lang.String prompt) throws java.io.IOExceptionReads a single line from the console and sets the console's prompt toprompt- Throws:
java.io.IOException
-
flush
public abstract void flush() throws java.io.IOExceptionFlushes the console's output- Throws:
java.io.IOException
-
print
public abstract void print(java.lang.String s) throws java.io.IOExceptionPrints a single string to the console- Throws:
java.io.IOException
-
println
public abstract void println() throws java.io.IOExceptionPrints the newline character-sequence to the console- Throws:
java.io.IOException
-
println
public abstract void println(java.lang.String s) throws java.io.IOExceptionPrints a string and the newline character-sequence to the console- Throws:
java.io.IOException
-
tryInvoke
private static java.lang.Object tryInvoke(java.lang.Object obj, java.lang.String method, java.lang.Class[] paramTypes, java.lang.Object... args)
-
getConsole
public static ShellConsole getConsole(java.io.InputStream in, java.io.PrintStream ps, java.nio.charset.Charset cs)
-
getConsole
public static ShellConsole getConsole(Scriptable scope, java.nio.charset.Charset cs)
Provides a specializedShellConsoleto handle line editing, history and completion. Relies on the JLine library (see http://jline.sourceforge.net).
-
getJLineShellConsoleV1
private static ShellConsole.JLineShellConsoleV1 getJLineShellConsoleV1(java.lang.ClassLoader classLoader, java.lang.Class<?> readerClass, Scriptable scope, java.nio.charset.Charset cs) throws java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
- Throws:
java.lang.NoSuchMethodExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
getJLineShellConsoleV2
private static ShellConsole.JLineShellConsoleV2 getJLineShellConsoleV2(java.lang.ClassLoader classLoader, java.lang.Class<?> readerClass, Scriptable scope, java.nio.charset.Charset cs) throws java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
- Throws:
java.lang.NoSuchMethodExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
-