public class ConsoleIO extends Object
Constructor and Description |
---|
ConsoleIO(ConsoleState info)
Constructor
|
ConsoleIO(InputStream input,
OutputStream out,
ConsoleState info)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
askProceed(String msg,
boolean defaultValue)
Ask if the user wants to continue
|
org.jline.reader.LineReader |
getLineReader()
Get the JLine line reader
|
OutputStream |
getOutputStream()
Get JLine terminal output stream
|
protected String |
readCommand()
Read a command from input
|
String |
readln(String... message)
Read message from input
|
String |
readMultiLineInput()
Reads multiple lines from the input until a line that with a '.' on its own is read.
|
String |
readMultiLineInput(String prompt)
Reads multiple lines from the input until a line that with a '.' on its own is read.
|
String |
readPassword(String prompt)
Read password from input
|
void |
setCautious()
Be cautious when executing commands, opposite of force
|
protected void |
setEcho(boolean echo)
Whether to echo user input to output stream
|
void |
setForce()
Force commands to proceed
|
void |
setQuiet(boolean quiet)
Whether to suppress printing of prompts to output
|
boolean |
wasErrorWritten()
Check if an error was written to the console
|
void |
write(String string)
Write a string
|
void |
writeError(String errMsg)
Write an error message
|
void |
writeln()
Write a newline
|
void |
writeln(String string)
Write a string, followed by a newline
|
void |
writeParseError(String prefix,
long lineNo,
long colNo,
String msg)
Write parser error
|
void |
writeUnopenedError()
Write a "please open first" error message
|
public ConsoleIO(InputStream input, OutputStream out, ConsoleState info) throws IOException
input
- out
- info
- IOException
public ConsoleIO(ConsoleState info) throws IOException
info
- IOException
public org.jline.reader.LineReader getLineReader()
public OutputStream getOutputStream()
protected String readCommand() throws IOException
IOException
public String readMultiLineInput() throws IOException
IOException
public String readMultiLineInput(String prompt) throws IOException
prompt
- IOException
public String readln(String... message) throws IOException
message
- one or multiple messagesIOException
public String readPassword(String prompt) throws IOException
prompt
- prompt to displayIOException
public void write(String string)
string
- string to writepublic void writeln()
public void writeln(String string)
string
- string to writepublic void writeError(String errMsg)
errMsg
- error messagepublic void writeUnopenedError()
public void writeParseError(String prefix, long lineNo, long colNo, String msg)
prefix
- lineNo
- line numbercolNo
- column numbermsg
- message to writepublic boolean askProceed(String msg, boolean defaultValue) throws IOException
msg
- confirmation questiondefaultValue
- true when default is yesIOException
protected void setEcho(boolean echo)
echo
- true to echo inputpublic void setQuiet(boolean quiet)
quiet
- true to suppress printingpublic void setForce()
public void setCautious()
public boolean wasErrorWritten()
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.