Package com.aoindustries.io
Class TerminalWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.PrintWriter
-
- com.aoindustries.io.TerminalWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class TerminalWriter extends PrintWriter
A writer that controls advanced features of VT/100 terminals, while silently reverting to standard behavior where the functions are not supported.- Author:
- AO Industries, Inc.
-
-
Field Summary
-
Fields inherited from class java.io.PrintWriter
out
-
-
Constructor Summary
Constructors Constructor Description TerminalWriter(Writer out)TerminalWriter(Writer out, boolean autoFlush)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattributesOff()voidboldOn()voidclearScreen()booleanisEnabled()static booleanisSupported()StringprogressOutput(String lastVerboseString, String newVerboseString)static StringprogressOutput(String lastVerboseString, String newVerboseString, PrintStream out)(Over)writes a progress line to the given PrintStream.static StringprogressOutput(String lastVerboseString, String newVerboseString, Writer out)(Over)writes a progress line to the given PrintStream.voidsetEnabled(boolean enabled)Enables the special features of the terminal writer.-
Methods inherited from class java.io.PrintWriter
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, write, write, write
-
-
-
-
Method Detail
-
isSupported
public static boolean isSupported()
-
progressOutput
public static String progressOutput(String lastVerboseString, String newVerboseString, PrintStream out)
(Over)writes a progress line to the given PrintStream. Any extra characters from previous output are covered with spaces. Any common prefix is not overwritten.- Parameters:
lastVerboseString- The last line outputnewVerboseString- The new line to display- Returns:
- The new line (newVerboseString)
-
progressOutput
public static String progressOutput(String lastVerboseString, String newVerboseString, Writer out) throws IOException
(Over)writes a progress line to the given PrintStream. Any extra characters from previous output are covered with spaces. Any common prefix is not overwritten.- Parameters:
lastVerboseString- The last line outputnewVerboseString- The new line to display- Returns:
- The new line (newVerboseString)
- Throws:
IOException
-
attributesOff
public void attributesOff() throws IOException- Throws:
IOException
-
boldOn
public void boldOn() throws IOException- Throws:
IOException
-
clearScreen
public void clearScreen() throws IOException- Throws:
IOException
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
Enables the special features of the terminal writer.
-
progressOutput
public String progressOutput(String lastVerboseString, String newVerboseString) throws IOException
-
-