public class Console extends Object
| Constructor and Description |
|---|
Console(InstallData installData,
ConsolePrefs prefs)
Constructs a Console with System.in and System.out as the I/O streams.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flush the console output stream.
|
void |
print(String message)
Prints a message to the console.
|
void |
printFilledLine(char c) |
void |
println()
Prints a new line.
|
void |
println(String message)
Prints a message to the console with a new line.
|
void |
printMessageBox(String title,
String message) |
void |
printMultiLine(String text,
boolean wrap,
boolean paging) |
int |
prompt(String prompt,
int min,
int max,
int eof)
Displays a prompt and waits for numeric input.
|
int |
prompt(String prompt,
int min,
int max,
int defaultValue,
int eof)
Displays a prompt and waits for numeric input.
|
String |
prompt(String prompt,
String defaultValue)
Displays a prompt and waits for input.
|
String |
prompt(String prompt,
String[] values)
Prompts for a value from a set of values.
|
String |
prompt(String prompt,
String[] values,
String defaultValue)
Prompts for a value from a set of values.
|
String |
promptLocation(String prompt,
String defaultValue)
Displays a prompt and waits for input.
|
String |
promptPassword(String prompt,
String defaultValue)
Displays a prompt and waits for input.
|
int |
read()
Read a character from the console.
|
String |
readLine()
Reads a line of text.
|
public Console(InstallData installData, ConsolePrefs prefs)
public int read()
throws IOException
IOException - If an I/O error occurspublic String readLine() throws IOException
IOException - if an I/O error occurspublic void flush()
throws IOException
IOException - if an I/O error occurspublic void printMultiLine(String text, boolean wrap, boolean paging) throws IOException
IOExceptionpublic void printFilledLine(char c)
public void print(String message)
message - the message to printpublic void println()
public void println(String message)
message - the message to printpublic int prompt(String prompt, int min, int max, int eof)
prompt - the prompt to displaymin - the minimum allowed valuemax - the maximum allowed valueeof - the value to return if end of stream is reachedpublic int prompt(String prompt, int min, int max, int defaultValue, int eof)
prompt - the prompt to displaymin - the minimum allowed valuemax - the maximum allowed valuedefaultValue - the default value to use, if no input is entered. Use a value < min if there is no
defaulteof - the value to return if end of stream is reachedpublic String promptLocation(String prompt, String defaultValue)
prompt - the prompt to displaydefaultValue - the default value to use, if no input is enteredpublic String promptPassword(String prompt, String defaultValue)
prompt - the prompt to displaydefaultValue - the default value to use, if no input is enteredpublic String prompt(String prompt, String defaultValue)
prompt - the prompt to displaydefaultValue - the default value to use, if no input is enteredpublic String prompt(String prompt, String[] values)
prompt - the prompt to displayvalues - the valid valuespublic String prompt(String prompt, String[] values, String defaultValue)
prompt - the prompt to displayvalues - the valid valuesdefaultValue - the default value to return when the user input is emptyCopyright © 2001–2025. All rights reserved.