public abstract class AbstractTextInterfaceDevice extends AbstractPasswordPrompter implements TextInterfaceDevice, PasswordPrompter, OutputDevice
TextInterfaceDevice that implements any common utilities among all interface
devices.| Modifier and Type | Field and Description |
|---|---|
protected PrintStream |
err |
protected InputStream |
in |
protected PrintStream |
out |
CONSOLE| Constructor and Description |
|---|
AbstractTextInterfaceDevice(InputStream inputStream,
PrintStream outputStream,
PrintStream errorStream) |
| Modifier and Type | Method and Description |
|---|---|
PrintStream |
err()
Gets the standard error stream.
|
void |
exit()
Terminates the currently running application normally (with a status code of zero).
|
InputStream |
in()
Gets the standard input stream.
|
PrintStream |
out()
Gets the standard output stream.
|
void |
outputErrorMessage(String message) |
void |
outputMessage(String message) |
void |
printErr(char c)
Prints a
char to standard-err. |
void |
printErr(Object o)
Prints an
Object to standard-out. |
void |
printErr(String s)
Prints a
String to standard-err. |
void |
printErrLn()
Terminates the current standard-err line by writing the line separator string.
|
void |
printErrLn(char c)
Prints a
char to standard-err, then terminates the current line by writing the line separator string. |
void |
printErrLn(Object o)
Prints an
Object to standard-err, then terminates the current line by writing the line separator string. |
void |
printErrLn(String s)
Prints a
String to standard-err, then terminates the current line by writing the line separator string. |
void |
printOut(char c)
Prints a
char to standard-out. |
void |
printOut(Object o)
Prints an
Object to standard-out. |
void |
printOut(String s)
Prints a
String to standard-out. |
void |
printOutLn()
Terminates the current standard-out line by writing the line separator string.
|
void |
printOutLn(char c)
Prints a
char to standard-out, then terminates the current line by writing the line separator string. |
void |
printOutLn(Object o)
Prints an
Object to standard-out, then terminates the current line by writing the line separator string. |
void |
printOutLn(String s)
Prints a
String to standard-out, then terminates the current line by writing the line separator string. |
char[] |
promptForValidPassword(int minLength,
int maxLength,
String what)
Prompts for a valid password by asking for the password using
PasswordPrompter.readPassword(String, Object...), checking
its length against the constraints, asking for the password to be confirmed, and checking to make sure the
passwords match. |
passwordsMatch, promptForValidPasswordclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexit, format, getReader, getWriter, printf, readLine, readLine, readPassword, readPassword, registerShutdownHook, unregisterShutdownHookpasswordsMatch, promptForValidPasswordprotected final InputStream in
protected final PrintStream out
protected final PrintStream err
public AbstractTextInterfaceDevice(InputStream inputStream, PrintStream outputStream, PrintStream errorStream)
public void exit()
TextInterfaceDevice.exit(int) with an exitCode of 0.exit in interface TextInterfaceDevicepublic void printOut(char c)
throws IOError
char to standard-out.printOut in interface TextInterfaceDevicec - The char to be printedIOError - if an I/O error occurs.public void printOut(String s) throws IOError
String to standard-out.printOut in interface TextInterfaceDevices - The String to be printedIOError - if an I/O error occurs.public void printOut(Object o) throws IOError
Object to standard-out.printOut in interface TextInterfaceDeviceo - The Object to be printedIOError - if an I/O error occurs.public void printErr(char c)
throws IOError
char to standard-err.printErr in interface TextInterfaceDevicec - The char to be printedIOError - if an I/O error occurs.public void printErr(String s) throws IOError
String to standard-err.printErr in interface TextInterfaceDevices - The String to be printedIOError - if an I/O error occurs.public void printErr(Object o) throws IOError
Object to standard-out.printErr in interface TextInterfaceDeviceo - The Object to be printedIOError - if an I/O error occurs.public void printOutLn()
throws IOError
printOutLn in interface TextInterfaceDeviceIOError - if an I/O error occurs.public void printOutLn(char c)
throws IOError
char to standard-out, then terminates the current line by writing the line separator string.printOutLn in interface TextInterfaceDevicec - The char to be printedIOError - if an I/O error occurs.public void printOutLn(String s) throws IOError
String to standard-out, then terminates the current line by writing the line separator string.printOutLn in interface TextInterfaceDevices - The String to be printedIOError - if an I/O error occurs.public void outputMessage(String message) throws IOError
outputMessage in interface OutputDeviceIOErrorpublic void printOutLn(Object o) throws IOError
Object to standard-out, then terminates the current line by writing the line separator string.printOutLn in interface TextInterfaceDeviceo - The Object to be printedIOError - if an I/O error occurs.public void printErrLn()
throws IOError
printErrLn in interface TextInterfaceDeviceIOError - if an I/O error occurs.public void printErrLn(char c)
throws IOError
char to standard-err, then terminates the current line by writing the line separator string.printErrLn in interface TextInterfaceDevicec - The char to be printedIOError - if an I/O error occurs.public void printErrLn(String s) throws IOError
String to standard-err, then terminates the current line by writing the line separator string.printErrLn in interface TextInterfaceDevices - The String to be printedIOError - if an I/O error occurs.public void outputErrorMessage(String message) throws IOError
outputErrorMessage in interface OutputDeviceIOErrorpublic void printErrLn(Object o) throws IOError
Object to standard-err, then terminates the current line by writing the line separator string.printErrLn in interface TextInterfaceDeviceo - The Object to be printedIOError - if an I/O error occurs.public InputStream in()
in in interface TextInterfaceDevicepublic PrintStream out()
out in interface TextInterfaceDevicepublic PrintStream err()
err in interface TextInterfaceDevicepublic char[] promptForValidPassword(int minLength,
int maxLength,
String what)
throws IOError
PasswordPrompter.readPassword(String, Object...), checking
its length against the constraints, asking for the password to be confirmed, and checking to make sure the
passwords match.promptForValidPassword in interface PasswordPrompterminLength - The minimum legal length for the passwordmaxLength - The maximum legal length for the passwordwhat - What we're prompting for a password forIOError - if an I/O error occurs.Copyright © 2010-2013 NWTS Java Code. All Rights Reserved. Licensed Under the Apache License version 2.0.