public interface IOModel
IOModel interface defines the input and output methods
supported by both the IOConsole
and IODialog classes.| Modifier and Type | Method and Description |
|---|---|
void |
print(boolean x)
Makes sure that
print can display a boolean. |
void |
print(char x)
Makes sure that
print can display a char. |
void |
print(double x)
Makes sure that
print can display a double. |
void |
print(float x)
Makes sure that
print can display a float. |
void |
print(int x)
Makes sure that
print can display an int. |
void |
print(long x)
Makes sure that
print can display a long. |
void |
print(java.lang.Object x)
Makes sure that
print can display an Object. |
void |
print(java.lang.String value)
Displays the argument value, allowing for the possibility of more
output on the same line.
|
void |
println()
Completes the output line.
|
void |
println(boolean x)
Makes sure that
println can display a boolean. |
void |
println(char x)
Makes sure that
println can display a char. |
void |
println(double x)
Makes sure that
println can display a double. |
void |
println(float x)
Makes sure that
println can display a float. |
void |
println(int x)
Makes sure that
println can display an int. |
void |
println(long x)
Makes sure that
println can display a long. |
void |
println(java.lang.Object x)
Makes sure that
println can display an Object. |
void |
println(java.lang.String value)
Displays the value and then completes the line.
|
boolean |
readBoolean()
Reads and returns a boolean value from the user, which must match
either
true or false, ignoring case. |
boolean |
readBoolean(java.lang.String prompt)
Prompts the user to enter a boolean value, which is then returned as
the value of this method.
|
boolean |
readBoolean(java.lang.String prompt,
java.lang.String trueLabel,
java.lang.String falseLabel)
Prompts the user to enter a value, which is interpreted as a boolean value
by matching it against the
trueLabel and falseLabel
parameters. |
double |
readDouble()
Reads and returns a double-precision value from the user.
|
double |
readDouble(double low,
double high)
Reads and returns a double-precision value from the user, which is
constrained to be within the specified inclusive range.
|
double |
readDouble(java.lang.String prompt)
Prompts the user to enter an double-precision number, which is then
returned as the value of this method.
|
double |
readDouble(java.lang.String prompt,
double low,
double high)
Prompts the user to enter an double-precision number, which is then returned
as the value of this method.
|
int |
readInt()
Reads and returns an integer value from the user.
|
int |
readInt(int low,
int high)
Reads and returns an integer value from the user, which is constrained to
be within the specified inclusive range.
|
int |
readInt(java.lang.String prompt)
Prompts the user to enter an integer, which is then returned as the value
of this method.
|
int |
readInt(java.lang.String prompt,
int low,
int high)
Prompts the user to enter an integer, which is then returned as the value
of this method.
|
java.lang.String |
readLine()
Reads and returns a line of input, without including the end-of-line
characters that terminate the input.
|
java.lang.String |
readLine(java.lang.String prompt)
Prompts the user to enter a line of text, which is then returned
as the value of this method.
|
void |
showErrorMessage(java.lang.String msg)
Displays the error message.
|
void print(java.lang.String value)
print method is overloaded
so that value can be of any type.value - The value to be displayedvoid print(boolean x)
print can display a boolean.void print(char x)
print can display a char.void print(double x)
print can display a double.void print(float x)
print can display a float.void print(int x)
print can display an int.void print(long x)
print can display a long.void print(java.lang.Object x)
print can display an Object.void println()
void println(java.lang.String value)
println
method is overloaded so that value can be of any type.value - The value to be displayedvoid println(boolean x)
println can display a boolean.void println(char x)
println can display a char.void println(double x)
println can display a double.void println(float x)
println can display a float.void println(int x)
println can display an int.void println(long x)
println can display a long.void println(java.lang.Object x)
println can display an Object.void showErrorMessage(java.lang.String msg)
msg - The error msg to be displayedjava.lang.String readLine()
Stringjava.lang.String readLine(java.lang.String prompt)
prompt - The prompt string to display to the userStringint readInt()
int readInt(int low,
int high)
low - The lowest value in the permitted rangehigh - The highest value in the permitted rangeint readInt(java.lang.String prompt)
prompt - The prompt string to display to the userint readInt(java.lang.String prompt,
int low,
int high)
low and high.prompt - The prompt string to display to the userlow - The lowest value in the permitted rangehigh - The highest value in the permitted rangedouble readDouble()
doubledouble readDouble(double low,
double high)
low - The lowest value in the permitted rangehigh - The highest value in the permitted rangedoubledouble readDouble(java.lang.String prompt)
prompt - The prompt string to display to the userdoubledouble readDouble(java.lang.String prompt,
double low,
double high)
low and high.prompt - The prompt string to display to the userlow - The lowest value in the permitted rangehigh - The highest value in the permitted rangedoubleboolean readBoolean()
true or false, ignoring case.boolean readBoolean(java.lang.String prompt)
prompt - The prompt string to display to the userboolean readBoolean(java.lang.String prompt,
java.lang.String trueLabel,
java.lang.String falseLabel)
trueLabel and falseLabel
parameters.prompt - The prompt string to display to the usertrueLabel - The string used to indicate truefalseLabel - The string used to indicate false