Package org.openhab.core.io.console
Interface Console
- All Known Implementing Classes:
OSGiConsole
@NonNullByDefault
public interface Console
This interface must be implemented by consoles which want to use the
ConsoleInterpreter.
It allows basic output commands.- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable StringgetUser()Returns the user name associated with the console, or null if no user is associated.voidPrints a string to the console without appending a newline.default voidPrints formatted output to the console.voidPrints a string to the console followed by a newline.voidprintUsage(String s) usage output is treated differently from other output as it might differ between different kinds of consolesdefault StringReads a line from the console.
-
Method Details
-
printf
Prints formatted output to the console. This method formats the given string using the specified arguments and prints it to the console without appending a newline.- Parameters:
format- the format string (followingString.format(java.lang.String, java.lang.Object...)syntax)args- the arguments referenced by the format specifiers in the format string
-
print
Prints a string to the console without appending a newline.- Parameters:
s- the string to print
-
println
Prints a string to the console followed by a newline.- Parameters:
s- the string to print
-
printUsage
usage output is treated differently from other output as it might differ between different kinds of consoles- Parameters:
s- the main usage string (console independent)
-
readLine
Reads a line from the console. The prompt is displayed before the line is read.- Parameters:
prompt- the prompt to displaymask- the character to use for masking input (e.g. '*'), or null if no masking is required- Returns:
- the line read from the console
- Throws:
IOException- if an I/O error occurs
-
getUser
Returns the user name associated with the console, or null if no user is associated.- Returns:
- the user name, or null if no user is associated
-