Package org.eclipse.rdf4j.console
Class ConsoleIO
java.lang.Object
org.eclipse.rdf4j.console.ConsoleIO
-
Constructor Summary
ConstructorDescriptionConsoleIO
(InputStream input, OutputStream out, ConsoleState info) ConstructorConsoleIO
(ConsoleState info) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
askProceed
(String msg, boolean defaultValue) Ask if the user wants to continueorg.jline.reader.LineReader
Get the JLine line readerGet JLine terminal output streamprotected String
Read a command from inputRead message from inputReads multiple lines from the input until a line that with a '.' on its own is read.readMultiLineInput
(String prompt) Reads multiple lines from the input until a line that with a '.' on its own is read.readPassword
(String prompt) Read password from inputvoid
Be cautious when executing commands, opposite of forceprotected void
setEcho
(boolean echo) Whether to echo user input to output streamvoid
setForce()
Force commands to proceedvoid
setQuiet
(boolean quiet) Whether to suppress printing of prompts to outputboolean
Check if an error was written to the consolevoid
Write a stringvoid
writeError
(String errMsg) Write an error messagevoid
writeln()
Write a newlinevoid
Write a string, followed by a newlinevoid
writeParseError
(String prefix, long lineNo, long colNo, String msg) Write parser errorvoid
Write a "please open first" error message
-
Constructor Details
-
ConsoleIO
Constructor- Parameters:
input
-out
-info
-- Throws:
IOException
-
ConsoleIO
Constructor- Parameters:
info
-- Throws:
IOException
-
-
Method Details
-
getLineReader
public org.jline.reader.LineReader getLineReader()Get the JLine line reader- Returns:
- line reader
-
getOutputStream
-
readCommand
Read a command from input- Returns:
- one line of input, or null on error
-
readMultiLineInput
Reads multiple lines from the input until a line that with a '.' on its own is read.- Returns:
- input string
-
readMultiLineInput
-
readln
-
readPassword
-
write
-
writeln
public void writeln()Write a newline -
writeln
Write a string, followed by a newline- Parameters:
string
- string to write
-
writeError
-
writeUnopenedError
public void writeUnopenedError()Write a "please open first" error message -
writeParseError
-
askProceed
Ask if the user wants to continue- Parameters:
msg
- confirmation questiondefaultValue
- true when default is yes- Returns:
- true when continue
-
setEcho
protected void setEcho(boolean echo) Whether to echo user input to output stream- Parameters:
echo
- true to echo input
-
setQuiet
public void setQuiet(boolean quiet) Whether to suppress printing of prompts to output- Parameters:
quiet
- true to suppress printing
-
setForce
public void setForce()Force commands to proceed -
setCautious
public void setCautious()Be cautious when executing commands, opposite of force -
wasErrorWritten
public boolean wasErrorWritten()Check if an error was written to the console- Returns:
- true when error was written
-