Class 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.
    • Constructor Detail

      • TerminalWriter

        public TerminalWriter​(Writer out)
      • TerminalWriter

        public TerminalWriter​(Writer out,
                              boolean autoFlush)
    • 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 output
        newVerboseString - 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 output
        newVerboseString - The new line to display
        Returns:
        The new line (newVerboseString)
        Throws:
        IOException
      • isEnabled

        public boolean isEnabled()
      • setEnabled

        public void setEnabled​(boolean enabled)
        Enables the special features of the terminal writer.