Package de.mhus.lib.core.console
Class SimpleConsole
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- de.mhus.lib.core.console.Console
-
- de.mhus.lib.core.console.SimpleConsole
-
- All Implemented Interfaces:
Adaptable,IBase,Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
CmdConsole
public class SimpleConsole extends Console
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.mhus.lib.core.console.Console
Console.COLOR
-
-
Field Summary
Fields Modifier and Type Field Description protected intheightprotected intwidth-
Fields inherited from class de.mhus.lib.core.console.Console
DEFAULT_HEIGHT, DEFAULT_WIDTH, history
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description SimpleConsole()SimpleConsole(InputStream in, PrintStream out)SimpleConsole(InputStream in, PrintStream out, boolean flush, String charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Console.COLORgetBackgroundColor()intgetCursorX()intgetCursorY()Console.COLORgetForegroundColor()intgetHeight()intgetWidth()booleanisBlink()booleanisBold()booleanisSupportBlink()booleanisSupportBold()booleanisSupportColor()booleanisSupportCursor()booleanisSupportSize()Return true if the console knows about the current size of the terminal.intread()Returns the next character from input stream of the console.ConsoleKeyreadKey()StringreadLine(LinkedList<String> history)voidsetBlink(boolean blink)voidsetBold(boolean bold)voidsetColor(Console.COLOR foreground, Console.COLOR background)voidsetCursor(int x, int y)-
Methods inherited from class de.mhus.lib.core.console.Console
adaptTo, askQuestion, cr, create, createProgressBar, get, isAnsi, isInitialized, printLine, printLine, readLine, readPassword, resetConsole, resetTerminal, set, setHeight, setWidth
-
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write
-
Methods inherited from class java.io.FilterOutputStream
write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
SimpleConsole
public SimpleConsole()
-
SimpleConsole
public SimpleConsole(InputStream in, PrintStream out, boolean flush, String charset) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
SimpleConsole
public SimpleConsole(InputStream in, PrintStream out)
-
-
Method Detail
-
readLine
public String readLine(LinkedList<String> history)
-
read
public int read()
Description copied from class:ConsoleReturns the next character from input stream of the console. In some cases check for ALT key pressed and return character + 1000, see JLine ConsoleReader In case of error a value lesser 0 will be returned.
-
readKey
public ConsoleKey readKey()
-
isSupportSize
public boolean isSupportSize()
Description copied from class:ConsoleReturn true if the console knows about the current size of the terminal.- Specified by:
isSupportSizein classConsole- Returns:
- True if support size
-
isSupportCursor
public boolean isSupportCursor()
- Specified by:
isSupportCursorin classConsole
-
getCursorX
public int getCursorX()
- Specified by:
getCursorXin classConsole
-
getCursorY
public int getCursorY()
- Specified by:
getCursorYin classConsole
-
isSupportColor
public boolean isSupportColor()
- Specified by:
isSupportColorin classConsole
-
setColor
public void setColor(Console.COLOR foreground, Console.COLOR background)
-
getForegroundColor
public Console.COLOR getForegroundColor()
- Specified by:
getForegroundColorin classConsole
-
getBackgroundColor
public Console.COLOR getBackgroundColor()
- Specified by:
getBackgroundColorin classConsole
-
isSupportBlink
public boolean isSupportBlink()
- Specified by:
isSupportBlinkin classConsole
-
isSupportBold
public boolean isSupportBold()
- Specified by:
isSupportBoldin classConsole
-
-