public interface TextTerminal<T extends TextTerminal<T>>
Modifier and Type | Method and Description |
---|---|
default void |
abort()
This method is typically called when a text-based input/output session has been aborted by the user or when a severe error occurred.
|
default void |
dispose()
Convenience method for disposing the terminal without providing information about the outcome of the input/output session.
|
default void |
dispose(java.lang.String resultData)
This method is typically called at the end of a text-based input/output session in order to allow the terminal to release its screen resources.
|
TerminalProperties<T> |
getProperties() |
default void |
init()
This method is typically called after the terminal has been created.
|
default void |
print(java.util.List<java.lang.String> messages)
Prints each message in the list, inserting the line separator string between messages.
|
default void |
print(java.lang.String message)
Prints a message that possibly contains line separators.
|
default void |
printf(java.util.Locale l,
java.lang.String format,
java.lang.Object... args)
Prints a formatted string using the specified locale, format string and arguments.
|
default void |
printf(java.lang.String format,
java.lang.Object... args)
Prints a formatted string using the default locale and the specified format string and arguments.
|
void |
println()
Terminates the current line by writing the line separator string.
|
default void |
println(java.util.List<java.lang.String> messages)
Prints each message in the list, inserting the line separator string between messages.
|
default void |
println(java.lang.String message)
Prints a message that possibly contains line separators and subsequently prints a line separator.
|
default void |
rawPrint(java.util.List<java.lang.String> messages)
Prints each message in the list in its raw form, inserting the line separator string between messages.
|
void |
rawPrint(java.lang.String message)
Prints the message in its raw form.
|
java.lang.String |
read(boolean masking)
Reads a line of text
|
boolean |
registerUserInterruptHandler(java.util.function.Consumer<T> handler,
boolean abortRead)
Registers a handler that will be called in response to a user interrupt.
|
default boolean |
resetLine()
Clears the current line of text.
|
default boolean |
resetToBookmark(java.lang.String bookmark)
Clears the text after the given bookmark.
|
default boolean |
setBookmark(java.lang.String bookmark)
Sets a bookmark with the given name at the current position.
|
java.lang.String read(boolean masking)
masking
- true, if the input should be masked (for example to enter a password)void rawPrint(java.lang.String message)
void println()
TerminalProperties<T> getProperties()
TerminalProperties
of this text terminal.boolean registerUserInterruptHandler(java.util.function.Consumer<T> handler, boolean abortRead)
handler
- the action to be performed in response to a user interrupt.abortRead
- true, if the current read operation should be aborted on user interrupt.default void init()
default void dispose(java.lang.String resultData)
resultData
- stringified information about the outcome of the input/output session; may be null,default void dispose()
dispose(String)
with a null argument.default void abort()
default boolean resetLine()
println()
and returns false.default boolean setBookmark(java.lang.String bookmark)
resetToBookmark(String)
in order to clear the text after this bookmark.
If a bookmark with this name already exists, it will be overwritten.
Since not all terminals support this feature, the default implementation does nothing and returns false.default boolean resetToBookmark(java.lang.String bookmark)
resetToBookmark(String)
in order to clear the text after this bookmark.
Since not all terminals support this feature, the default implementation does nothing and returns false.default void rawPrint(java.util.List<java.lang.String> messages)
default void print(java.lang.String message)
default void println(java.lang.String message)
default void print(java.util.List<java.lang.String> messages)
default void println(java.util.List<java.lang.String> messages)
default void printf(java.lang.String format, java.lang.Object... args)
format
- A format string as described in Formatter
.args
- Arguments referenced by the format specifiers in the format string.default void printf(java.util.Locale l, java.lang.String format, java.lang.Object... args)
l
- The locale to apply during formatting. If l
is null
then no localization is applied.format
- A format string as described in Formatter
.args
- Arguments referenced by the format specifiers in the format string.