Class ConsolePrompt
java.lang.Object
com.github.rvesse.airline.prompts.console.ConsolePrompt
- All Implemented Interfaces:
PromptProvider
A prompt that is backed by
System.console()-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new console prompt using the defaultSystem.console()ConsolePrompt(Console console) Creates a new console prompt using the specified console -
Method Summary
Modifier and TypeMethodDescriptionGets the writer to which prompts should be writtenintreadKey()Reads a single key from the prompts sourcereadLine()Reads a line from the prompts sourcechar[]Reads a line from the prompts source in a secure mannerbooleanWhether the provider supports secured reads
-
Field Details
-
console
-
-
Constructor Details
-
ConsolePrompt
public ConsolePrompt()Creates a new console prompt using the defaultSystem.console() -
ConsolePrompt
Creates a new console prompt using the specified console- Parameters:
console- Console
-
-
Method Details
-
getPromptWriter
Description copied from interface:PromptProviderGets the writer to which prompts should be written- Specified by:
getPromptWriterin interfacePromptProvider- Returns:
- Prompt writer
-
readLine
Description copied from interface:PromptProviderReads a line from the prompts source- Specified by:
readLinein interfacePromptProvider- Returns:
- Line (or
nullif unable to read a line)
-
readKey
public int readKey()Description copied from interface:PromptProviderReads a single key from the prompts source- Specified by:
readKeyin interfacePromptProvider- Returns:
- Key code (or -1 if unable to read a key)
-
readSecureLine
public char[] readSecureLine()Description copied from interface:PromptProviderReads a line from the prompts source in a secure manner- Specified by:
readSecureLinein interfacePromptProvider- Returns:
- Line (or
nullif unable to read a line)
-
supportsSecureReads
public boolean supportsSecureReads()Description copied from interface:PromptProviderWhether the provider supports secured reads- Specified by:
supportsSecureReadsin interfacePromptProvider- Returns:
- True if supported, false otherwise
-