public class Console extends Object
| Modifier and Type | Field and Description |
|---|---|
protected jline.console.ConsoleReader |
console |
protected Logger |
log |
protected CliSession |
session |
| Constructor and Description |
|---|
Console(Database db,
InputStream input,
OutputStream output)
Simplified constructor for
SessionMode.CORE_API mode. |
Console(JSimpleDB jdb,
InputStream input,
OutputStream output)
Simplified constructor for
SessionMode.JSIMPLEDB mode. |
Console(KVDatabase kvdb,
Database db,
JSimpleDB jdb,
InputStream input,
OutputStream output,
jline.Terminal terminal,
String encoding,
String appName)
Generic constructor.
|
Console(KVDatabase kvdb,
InputStream input,
OutputStream output)
Simplified constructor for
SessionMode.KEY_VALUE mode. |
| Modifier and Type | Method and Description |
|---|---|
jline.console.ConsoleReader |
getConsoleReader()
Get the associated JLine
ConsoleReader. |
CliSession |
getSession()
Get the associated
CliSession. |
static jline.Terminal |
getTerminal()
Get the
Terminal instance appropriate for this operating system. |
List<CliSession.Action> |
parseCommand(String text)
Parse the given command(s).
|
void |
run()
Run this instance.
|
boolean |
runNonInteractive(Reader input,
String inputDescription)
Run this instance in non-interactive (or "batch") mode on the given input.
|
void |
setHistoryFile(File historyFile)
Set/update the command history file.
|
protected final Logger log
protected final jline.console.ConsoleReader console
protected final CliSession session
public Console(KVDatabase kvdb, InputStream input, OutputStream output) throws IOException
SessionMode.KEY_VALUE mode.kvdb - key/value KVDatabaseinput - console inputoutput - console outputIOException - if an I/O error occurspublic Console(Database db, InputStream input, OutputStream output) throws IOException
SessionMode.CORE_API mode.db - core API Databaseinput - console inputoutput - console outputIOException - if an I/O error occurspublic Console(JSimpleDB jdb, InputStream input, OutputStream output) throws IOException
SessionMode.JSIMPLEDB mode.jdb - JSimpleDB databaseinput - console inputoutput - console outputIOException - if an I/O error occurspublic Console(KVDatabase kvdb, Database db, JSimpleDB jdb, InputStream input, OutputStream output, jline.Terminal terminal, String encoding, String appName) throws IOException
kvdb - KVDatabase for SessionMode.KEY_VALUE (otherwise must be null)db - Database for SessionMode.CORE_API (otherwise must be null)jdb - JSimpleDB for SessionMode.JSIMPLEDB (otherwise must be null)input - console inputoutput - console outputterminal - JLine terminal interface, or null for defaultencoding - character encoding for terminal, or null for defaultappName - JLine application name, or null for noneIOException - if an I/O error occursIllegalArgumentException - if not exactly one of kvdb, db or jdb is not nullpublic jline.console.ConsoleReader getConsoleReader()
ConsoleReader.public CliSession getSession()
CliSession.public void setHistoryFile(File historyFile) throws IOException
historyFile - file for storing command historyIOException - if historyFile cannot be readIllegalArgumentException - if historyFile is nullpublic boolean runNonInteractive(Reader input, String inputDescription) throws IOException
input - command input; is not closed by this methodinputDescription - description of input (e.g., file name) used for error reporting, or null for noneIOException - if an I/O error occurspublic void run()
throws IOException
IOException - if an I/O error occurspublic List<CliSession.Action> parseCommand(String text)
text - command inputParseException - if text cannot be parsedIllegalArgumentException - if text is nullpublic static jline.Terminal getTerminal()
throws IOException
Terminal instance appropriate for this operating system.Terminal to useIOExceptionCopyright © 2016. All rights reserved.