Package com.aoindustries.util
Class ShellInterpreter
- java.lang.Object
-
- com.aoindustries.util.ShellInterpreter
-
-
Field Summary
Fields Modifier and Type Field Description protected TerminalWritererrprotected Readerinprotected TerminalWriteroutprotected Stringstatus
-
Constructor Summary
Constructors Constructor Description ShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err)ShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err, String... args)ShellInterpreter(Reader in, Writer out, Writer err)ShellInterpreter(Reader in, Writer out, Writer err, String[] args)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear(String[] args)Clears the screen.protected abstract StringgetName()longgetPID()protected abstract StringgetPrompt()protected abstract booleanhandleCommand(String[] args)Processes one command and returns.protected booleanisAlive()protected booleanisInteractive()voidjobs(String[] args)protected abstract ShellInterpreternewShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err, String[] args)voidrun()If arguments were provided, executes that command.
-
-
-
Field Detail
-
in
protected final Reader in
-
out
protected final TerminalWriter out
-
err
protected final TerminalWriter err
-
status
protected String status
-
-
Constructor Detail
-
ShellInterpreter
public ShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err)
-
ShellInterpreter
public ShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err, String... args)
-
-
Method Detail
-
clear
public final void clear(String[] args) throws IOException
Clears the screen.- Throws:
IOException
-
getName
protected abstract String getName()
-
getPID
public final long getPID()
-
getPrompt
protected abstract String getPrompt() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
handleCommand
protected abstract boolean handleCommand(String[] args) throws IOException, SQLException
Processes one command and returns.- Throws:
IOExceptionSQLException
-
isAlive
protected final boolean isAlive()
-
isInteractive
protected final boolean isInteractive()
-
jobs
public final void jobs(String[] args)
-
newShellInterpreter
protected abstract ShellInterpreter newShellInterpreter(Reader in, TerminalWriter out, TerminalWriter err, String[] args)
-
-