Class StreamPrompt
- java.lang.Object
-
- com.github.rvesse.airline.prompts.console.StreamPrompt
-
- All Implemented Interfaces:
PromptProvider
- Direct Known Subclasses:
StdIOPrompt
public class StreamPrompt extends java.lang.Object implements PromptProvider
Creates a new prompt backed by arbitrary streams
-
-
Constructor Summary
Constructors Constructor Description StreamPrompt(java.io.OutputStream output, java.io.InputStream input)Creates a new stream prompt
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.PrintWritergetPromptWriter()Gets the writer to which prompts should be writtenintreadKey()Reads a single key from the prompts sourcejava.lang.StringreadLine()Reads a line from the prompts sourcechar[]readSecureLine()Reads a line from the prompts source in a secure mannerbooleansupportsSecureReads()Whether the provider supports secured reads
-
-
-
Method Detail
-
getPromptWriter
public java.io.PrintWriter getPromptWriter()
Description copied from interface:PromptProviderGets the writer to which prompts should be written- Specified by:
getPromptWriterin interfacePromptProvider- Returns:
- Prompt writer
-
readLine
public java.lang.String 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)
-
supportsSecureReads
public boolean supportsSecureReads()
Description copied from interface:PromptProviderWhether the provider supports secured reads- Specified by:
supportsSecureReadsin interfacePromptProvider- Returns:
- True if supported, false otherwise
-
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)
-
-