public interface Console extends ProgressInterface
OVERWRITE_ALL, OVERWRITE_NEVER, OVERWRITE_NO, OVERWRITE_YES, RETRY_CANCEL, RETRY_NO, RETRY_YES
Modifier and Type | Method and Description |
---|---|
int[] |
askMultipleSelection(java.lang.String message,
java.lang.String[] descriptions,
java.lang.String[] keys,
int[] defaultValues,
boolean oneLinePerOption)
Ask the user to select multiple elements from a list of options.
|
boolean |
askOkCancel(java.lang.String message)
Ask the user a question that has to be answered with "OK" or "Cancel".
|
boolean |
askOkCancel(java.lang.String message,
boolean defaultValue)
Ask the user a question that has to be answered with "OK" or "Cancel".
|
int |
askOption(java.lang.String message,
java.lang.String[] descriptions,
java.lang.String[] keys)
Ask the user a question with a fixed set of answers.
|
int |
askOption(java.lang.String message,
java.lang.String[] descriptions,
java.lang.String[] keys,
int defaultValue)
Ask the user a question with a fixed set of answers.
|
int |
askOption(java.lang.String message,
java.lang.String[] descriptions,
java.lang.String[] keys,
int defaultValue,
boolean allowNoSelection,
boolean oneLinePerOption)
Ask the user a question with a fixed set of answers.
|
java.lang.String |
askPassword(java.lang.String message,
java.lang.String defaultValue)
Ask the user to enter a password.
|
java.lang.String |
askString(java.lang.String message,
java.lang.String defaultValue)
Ask the user to enter a string with a default string that can be accepted by the user.
|
boolean |
askYesNo(java.lang.String message)
Ask the user a question that has to be answered with "Yes" or "No".
|
boolean |
askYesNo(java.lang.String message,
boolean defaultValue)
Ask the user a question that has to be answered with "Yes" or "No".
|
void |
more(java.lang.String text)
Print a long text to the console and partition it into pages.
|
void |
print(java.lang.Object val)
Print an object to the console by invoking its toString() method.
|
void |
printHeader(java.lang.String title)
Print the header for a new screen.
|
void |
println()
Print a line feed to the console.
|
void |
println(java.lang.Object val)
Print an object to the console by invoking its toString() method and append a line feed.
|
java.lang.String |
readLine()
Read input from the console.
|
void |
waitForEnter()
Print [Enter] to the console and wait for the user to hit the Enter key.
|
askContinue, askOverwrite, askRetry, getPercentCompleted, setDetailMessage, setIndeterminateProgress, setPercentCompleted, setSecondaryPercentCompleted, setStatusMessage, showFailure
void print(java.lang.Object val)
val
- the object to be printedvoid println(java.lang.Object val)
val
- the object to be printedvoid println()
void more(java.lang.String text) throws UserCanceledException
text
- the textUserCanceledException
- if the user cancels the "more" notice, typically with CTRL-Cjava.lang.String readLine() throws UserCanceledException
UserCanceledException
- if the user cancels the prompt, typically with CTRL-Cboolean askYesNo(java.lang.String message) throws UserCanceledException
message
- the questionUserCanceledException
- if the user cancels the question, typically with CTRL-Cboolean askYesNo(java.lang.String message, boolean defaultValue) throws UserCanceledException
message
- the questiondefaultValue
- whether "Yes" is the default valueUserCanceledException
- if the user cancels the question, typically with CTRL-Cboolean askOkCancel(java.lang.String message) throws UserCanceledException
message
- the questionUserCanceledException
- if the user cancels the question, typically with CTRL-C.
Note that this is different from a "Cancel" answer.boolean askOkCancel(java.lang.String message, boolean defaultValue) throws UserCanceledException
message
- the questiondefaultValue
- whether "OK" is the default valueUserCanceledException
- if the user cancels the question, typically with CTRL-C.
Note that this is different from a "Cancel" answer.int askOption(java.lang.String message, java.lang.String[] descriptions, java.lang.String[] keys) throws UserCanceledException
message
- the questiondescriptions
- an array with a textual description for each optionkeys
- an array with a short key for each option. Keys are what the user enters to select the desired option.UserCanceledException
- if the user cancels the question, typically with CTRL-C.int askOption(java.lang.String message, java.lang.String[] descriptions, java.lang.String[] keys, int defaultValue) throws UserCanceledException
message
- the questiondescriptions
- an array with a textual description for each optionkeys
- an array with a short key for each option. Keys are what the user enters to select the desired option.defaultValue
- the index of the default optionUserCanceledException
- if the user cancels the question, typically with CTRL-C.int askOption(java.lang.String message, java.lang.String[] descriptions, java.lang.String[] keys, int defaultValue, boolean allowNoSelection, boolean oneLinePerOption) throws UserCanceledException
message
- the questiondescriptions
- an array with a textual description for each optionkeys
- an array with a short key for each option. Keys are what the user enters to select the desired option.defaultValue
- the index of the default optionallowNoSelection
- if the question should allow an empty answer, the return value is -1 in that case.oneLinePerOption
- if the options should be presented on option per line. By default, all options are presented on the same line.UserCanceledException
- if the user cancels the question, typically with CTRL-C.int[] askMultipleSelection(java.lang.String message, java.lang.String[] descriptions, java.lang.String[] keys, int[] defaultValues, boolean oneLinePerOption) throws UserCanceledException
message
- the questiondescriptions
- an array with a textual description for each optionkeys
- an array with a short key for each option. Keys are what the user enters to select the desired options.defaultValues
- an array with the indices of the options that are selected by defaultoneLinePerOption
- if the options should be presented on option per line. By default, all options are presented on the same line.UserCanceledException
- if the user cancels the question, typically with CTRL-C.java.lang.String askString(java.lang.String message, java.lang.String defaultValue) throws UserCanceledException
message
- the prompt before the inputdefaultValue
- the default stringUserCanceledException
- if the user cancels the question, typically with CTRL-C.java.lang.String askPassword(java.lang.String message, java.lang.String defaultValue) throws UserCanceledException
message
- the prompt before the inputdefaultValue
- the default stringUserCanceledException
- if the user cancels the question, typically with CTRL-C.void waitForEnter() throws UserCanceledException
UserCanceledException
- if the user cancels the notice, typically with CTRL-C.void printHeader(java.lang.String title) throws UserCanceledException
title
- the titleUserCanceledException
- if the user cancels the notice, typically with CTRL-C.