|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.console.CommandLineConsoleHelper
Command line console helper. This class is a simply implementation of the
ConsoleHelperInterface
interface. If you want to beneficiate of
advanced features (such as command completion, command historic, possibility
to hide password, ...), use the GUIConsoleHelper
class. These
features are impossible to obtain in pure Java. Native code must be used and
for example the java-readline project (http://java-readline.sf.net/).
Field Summary | |
private java.io.BufferedReader |
inbuf
BufferedReader allowing to reading input. |
private boolean |
interactive
true if the console is used in interactive mode. |
Constructor Summary | |
CommandLineConsoleHelper(java.io.InputStream in,
boolean interactive)
Creates a new CommandLineConsoleHelper instance reading from a
given InputStream . |
Method Summary | |
void |
print(java.lang.String s)
Prints a String . |
void |
printError(java.lang.String message)
Prints an error message followed by a new line. |
void |
println()
Prints a new line. |
void |
println(java.lang.String s)
Prints a String followed by a new line. |
java.lang.String |
readLine(java.lang.String prompt)
Gets a command. |
java.lang.String |
readPassword(java.lang.String prompt)
Gets a password. |
void |
setCommandCompletor(CommandCompletorInterface commandCompletor)
Not supported. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.io.BufferedReader inbuf
BufferedReader
allowing to reading input.
private boolean interactive
true
if the console is used in interactive mode.
Constructor Detail |
public CommandLineConsoleHelper(java.io.InputStream in, boolean interactive)
CommandLineConsoleHelper
instance reading from a
given InputStream
.
in
- an InputStream
instance.interactive
- true
if the console is used in interactive
mode.Method Detail |
public java.lang.String readLine(java.lang.String prompt) throws ConsoleHelperException
ConsoleHelperInterface
readLine
in interface ConsoleHelperInterface
prompt
- the prompt to display
String
instance
ConsoleHelperException
- if an error occurs.ConsoleHelperInterface.readLine(java.lang.String)
public java.lang.String readPassword(java.lang.String prompt) throws ConsoleHelperException
ConsoleHelperInterface
readPassword
in interface ConsoleHelperInterface
prompt
- the prompt to display
String
instance
ConsoleHelperException
- if an error occurs.ConsoleHelperInterface.readPassword(java.lang.String)
public void print(java.lang.String s)
ConsoleHelperInterface
String
.
print
in interface ConsoleHelperInterface
s
- the String
to print.ConsoleHelperInterface.print(java.lang.String)
public void println(java.lang.String s)
ConsoleHelperInterface
String
followed by a new line.
println
in interface ConsoleHelperInterface
s
- the String
to print.ConsoleHelperInterface.println(java.lang.String)
public void println()
ConsoleHelperInterface
println
in interface ConsoleHelperInterface
ConsoleHelperInterface.println()
public void printError(java.lang.String message)
ConsoleHelperInterface
printError
in interface ConsoleHelperInterface
message
- the error message to print.ConsoleHelperInterface.printError(java.lang.String)
public void setCommandCompletor(CommandCompletorInterface commandCompletor)
setCommandCompletor
in interface ConsoleHelperInterface
commandCompletor
- a CommandCompletor
instance.ConsoleHelperInterface.setCommandCompletor(org.objectweb.cjdbc.controller.console.CommandCompletorInterface)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |