Class WindowsAnsiWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

    public final class WindowsAnsiWriter
    extends AnsiWriter
    A Windows ANSI escape processor, that uses JNA to access native platform API's to change the console attributes.
    Since:
    1.0
    Author:
    Hiram Chirino, Joris Kuipers
    • Constructor Detail

      • WindowsAnsiWriter

        public WindowsAnsiWriter​(java.io.Writer out)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • processEraseScreen

        protected void processEraseScreen​(int eraseOption)
                                   throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI n J ANSI code, corresponding to ED ? Erase in Display
        Overrides:
        processEraseScreen in class AnsiWriter
        Parameters:
        eraseOption - the erase option
        Throws:
        java.io.IOException - if an error occurs
      • processEraseLine

        protected void processEraseLine​(int eraseOption)
                                 throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI n K ANSI code, corresponding to ED ? Erase in Line
        Overrides:
        processEraseLine in class AnsiWriter
        Parameters:
        eraseOption - the erase option
        Throws:
        java.io.IOException - if an error occurs
      • processCursorUpLine

        protected void processCursorUpLine​(int count)
                                    throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n F corresponding to CPL ? Cursor Previous Line
        Overrides:
        processCursorUpLine in class AnsiWriter
        Parameters:
        count - line count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorDownLine

        protected void processCursorDownLine​(int count)
                                      throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n E corresponding to CNL ? Cursor Next Line
        Overrides:
        processCursorDownLine in class AnsiWriter
        Parameters:
        count - line count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorLeft

        protected void processCursorLeft​(int count)
                                  throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n D corresponding to CUB ? Cursor Back
        Overrides:
        processCursorLeft in class AnsiWriter
        Parameters:
        count - the count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorRight

        protected void processCursorRight​(int count)
                                   throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n C corresponding to CUF ? Cursor Forward
        Overrides:
        processCursorRight in class AnsiWriter
        Parameters:
        count - the count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorDown

        protected void processCursorDown​(int count)
                                  throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n B corresponding to CUD ? Cursor Down
        Overrides:
        processCursorDown in class AnsiWriter
        Parameters:
        count - the count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorUp

        protected void processCursorUp​(int count)
                                throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n A corresponding to CUU ? Cursor Up
        Overrides:
        processCursorUp in class AnsiWriter
        Parameters:
        count - the count
        Throws:
        java.io.IOException - if an error occurs
      • processCursorTo

        protected void processCursorTo​(int row,
                                       int col)
                                throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n ; m H corresponding to CUP ? Cursor Position or CSI n ; m f corresponding to HVP ? Horizontal and Vertical Position
        Overrides:
        processCursorTo in class AnsiWriter
        Parameters:
        row - the row
        col - the column
        Throws:
        java.io.IOException - if an error occurs
      • processCursorToColumn

        protected void processCursorToColumn​(int x)
                                      throws java.io.IOException
        Description copied from class: AnsiWriter
        process CSI n G corresponding to CHA ? Cursor Horizontal Absolute
        Overrides:
        processCursorToColumn in class AnsiWriter
        Parameters:
        x - the column
        Throws:
        java.io.IOException - if an error occurs
      • processSetForegroundColorExt

        protected void processSetForegroundColorExt​(int paletteIndex)
                                             throws java.io.IOException
        Description copied from class: AnsiWriter
        process SGR 38 corresponding to extended set text color (foreground) with a palette of 255 colors.
        Overrides:
        processSetForegroundColorExt in class AnsiWriter
        Parameters:
        paletteIndex - the text color in the palette
        Throws:
        java.io.IOException - if an error occurs
      • processSetBackgroundColorExt

        protected void processSetBackgroundColorExt​(int paletteIndex)
                                             throws java.io.IOException
        Description copied from class: AnsiWriter
        process SGR 48 corresponding to extended set background color with a palette of 255 colors.
        Overrides:
        processSetBackgroundColorExt in class AnsiWriter
        Parameters:
        paletteIndex - the background color in the palette
        Throws:
        java.io.IOException - if an error occurs
      • processDefaultTextColor

        protected void processDefaultTextColor()
                                        throws java.io.IOException
        Description copied from class: AnsiWriter
        process SGR 39 corresponding to Default text color (foreground)
        Overrides:
        processDefaultTextColor in class AnsiWriter
        Throws:
        java.io.IOException - if an error occurs
      • processDefaultBackgroundColor

        protected void processDefaultBackgroundColor()
                                              throws java.io.IOException
        Description copied from class: AnsiWriter
        process SGR 49 corresponding to Default background color
        Overrides:
        processDefaultBackgroundColor in class AnsiWriter
        Throws:
        java.io.IOException - if an error occurs
      • processAttributeRest

        protected void processAttributeRest()
                                     throws java.io.IOException
        Description copied from class: AnsiWriter
        process SGR 0 corresponding to Reset / Normal
        Overrides:
        processAttributeRest in class AnsiWriter
        Throws:
        java.io.IOException - if an error occurs
      • processSaveCursorPosition

        protected void processSaveCursorPosition()
                                          throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI s ANSI code, corresponding to SCP ? Save Cursor Position
        Overrides:
        processSaveCursorPosition in class AnsiWriter
        Throws:
        java.io.IOException - if an error occurs
      • processRestoreCursorPosition

        protected void processRestoreCursorPosition()
                                             throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI u ANSI code, corresponding to RCP ? Restore Cursor Position
        Overrides:
        processRestoreCursorPosition in class AnsiWriter
        Throws:
        java.io.IOException - if an error occurs
      • processInsertLine

        protected void processInsertLine​(int optionInt)
                                  throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI s ANSI code, corresponding to IL ? Insert Line
        Overrides:
        processInsertLine in class AnsiWriter
        Parameters:
        optionInt - the option
        Throws:
        java.io.IOException - if an error occurs
      • processDeleteLine

        protected void processDeleteLine​(int optionInt)
                                  throws java.io.IOException
        Description copied from class: AnsiWriter
        Process CSI s ANSI code, corresponding to DL ? Delete Line
        Overrides:
        processDeleteLine in class AnsiWriter
        Parameters:
        optionInt - the option
        Throws:
        java.io.IOException - if an error occurs
      • processChangeWindowTitle

        protected void processChangeWindowTitle​(java.lang.String title)
        Description copied from class: AnsiWriter
        process OSC 2;text BEL corresponding to Change Window title
        Overrides:
        processChangeWindowTitle in class AnsiWriter
        Parameters:
        title - the title