Class StreamPrompt
java.lang.Object
com.github.rvesse.airline.prompts.console.StreamPrompt
- All Implemented Interfaces:
PromptProvider
- Direct Known Subclasses:
StdIOPrompt
Creates a new prompt backed by arbitrary streams
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OutputStream
private final BufferedReader
private final PrintWriter
-
Constructor Summary
ConstructorsConstructorDescriptionStreamPrompt
(OutputStream output, InputStream input) Creates a new stream prompt -
Method Summary
Modifier and TypeMethodDescriptionGets the writer to which prompts should be writtenint
readKey()
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 mannerboolean
Whether the provider supports secured reads
-
Field Details
-
rawOutput
-
writer
-
reader
-
-
Constructor Details
-
StreamPrompt
Creates a new stream prompt- Parameters:
output
- Output streaminput
- Input stream
-
-
Method Details
-
getPromptWriter
Description copied from interface:PromptProvider
Gets the writer to which prompts should be written- Specified by:
getPromptWriter
in interfacePromptProvider
- Returns:
- Prompt writer
-
readLine
Description copied from interface:PromptProvider
Reads a line from the prompts source- Specified by:
readLine
in interfacePromptProvider
- Returns:
- Line (or
null
if unable to read a line)
-
readKey
public int readKey()Description copied from interface:PromptProvider
Reads a single key from the prompts source- Specified by:
readKey
in interfacePromptProvider
- Returns:
- Key code (or -1 if unable to read a key)
-
supportsSecureReads
public boolean supportsSecureReads()Description copied from interface:PromptProvider
Whether the provider supports secured reads- Specified by:
supportsSecureReads
in interfacePromptProvider
- Returns:
- True if supported, false otherwise
-
readSecureLine
public char[] readSecureLine()Description copied from interface:PromptProvider
Reads a line from the prompts source in a secure manner- Specified by:
readSecureLine
in interfacePromptProvider
- Returns:
- Line (or
null
if unable to read a line)
-