Package org.fusesource.jansi.io
Class WindowsAnsiProcessor
java.lang.Object
org.fusesource.jansi.io.AnsiProcessor
org.fusesource.jansi.io.WindowsAnsiProcessor
A Windows ANSI escape processor, that uses JNA to access native platform
API's to change the console attributes (see
Jansi native Kernel32).
The native library used is named jansi and is loaded using HawtJNI Runtime
Library
- Since:
- 1.19
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final short[]private static final short[]private static final shortprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate final longprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate static final shortprivate final Kernel32.CONSOLE_SCREEN_BUFFER_INFOprivate booleanprivate final shortprivate shortprivate shortFields inherited from class org.fusesource.jansi.io.AnsiProcessor
ATTRIBUTE_BLINK_FAST, ATTRIBUTE_BLINK_OFF, ATTRIBUTE_BLINK_SLOW, ATTRIBUTE_CONCEAL_OFF, ATTRIBUTE_CONCEAL_ON, ATTRIBUTE_INTENSITY_BOLD, ATTRIBUTE_INTENSITY_FAINT, ATTRIBUTE_INTENSITY_NORMAL, ATTRIBUTE_ITALIC, ATTRIBUTE_NEGATIVE_OFF, ATTRIBUTE_NEGATIVE_ON, ATTRIBUTE_UNDERLINE, ATTRIBUTE_UNDERLINE_DOUBLE, ATTRIBUTE_UNDERLINE_OFF, BLACK, BLUE, CYAN, ERASE_LINE, ERASE_LINE_TO_BEGINING, ERASE_LINE_TO_END, ERASE_SCREEN, ERASE_SCREEN_TO_BEGINING, ERASE_SCREEN_TO_END, GREEN, MAGENTA, os, RED, WHITE, YELLOW -
Constructor Summary
ConstructorsConstructorDescriptionWindowsAnsiProcessor(OutputStream ps, boolean stdout) WindowsAnsiProcessor(OutputStream ps, long console) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidprivate shortinvertAttributeColors(short attributes) protected voidprocessSGR 0corresponding toReset / Normalprotected voidprocessChangeWindowTitle(String label) processOSC 2;text BELcorresponding toChange Window titleprotected voidprocessCursorDown(int count) processCSI n Bcorresponding toCUD – Cursor Downprotected voidprocessCursorDownLine(int count) processCSI n Ecorresponding toCNL – Cursor Next Lineprotected voidprocessCursorLeft(int count) processCSI n Dcorresponding toCUB – Cursor Backprotected voidprocessCursorRight(int count) processCSI n Ccorresponding toCUF – Cursor Forwardprotected voidprocessCursorTo(int row, int col) processCSI n ; m Hcorresponding toCUP – Cursor PositionorCSI n ; m fcorresponding toHVP – Horizontal and Vertical Positionprotected voidprocessCursorToColumn(int x) processCSI n Gcorresponding toCHA – Cursor Horizontal Absoluteprotected voidprocessCursorUp(int count) processCSI n Acorresponding toCUU – Cursor Upprotected voidprocessCursorUpLine(int count) processCSI n Fcorresponding toCPL – Cursor Previous Lineprotected voidprocessSGR 49corresponding toDefault background colorprotected voidprocessSGR 39corresponding toDefault text color (foreground)protected voidprocessDeleteLine(int optionInt) ProcessCSI MANSI code, corresponding toDL – Delete Lineprotected voidprocessEraseLine(int eraseOption) ProcessCSI n KANSI code, corresponding toED – Erase in Lineprotected voidprocessEraseScreen(int eraseOption) ProcessCSI n JANSI code, corresponding toED – Erase in Displayprotected voidprocessInsertLine(int optionInt) ProcessCSI LANSI code, corresponding toIL – Insert Lineprotected voidProcessCSI uANSI code, corresponding toRCP – Restore Cursor Positionprotected voidProcessCSI sANSI code, corresponding toSCP – Save Cursor Positionprotected voidprocessSetAttribute(int attribute) processSGRother than0(reset),30-39(foreground),40-49(background),90-97(foreground high intensity) or100-107(background high intensity)protected voidprocessSetBackgroundColor(int color, boolean bright) processSGR 40-47orSGR 100-107corresponding toSet background coloreither in normal mode or high intensity.protected voidprocessSetBackgroundColorExt(int paletteIndex) processSGR 48corresponding toextended set background colorwith a palette of 255 colors.protected voidprocessSetBackgroundColorExt(int r, int g, int b) processSGR 48corresponding toextended set background colorwith a 24 bits RGB definition of the color.protected voidprocessSetForegroundColor(int color, boolean bright) processSGR 30-37orSGR 90-97corresponding toSet text color (foreground)either in normal mode or high intensity.protected voidprocessSetForegroundColorExt(int paletteIndex) processSGR 38corresponding toextended set text color (foreground)with a palette of 255 colors.protected voidprocessSetForegroundColorExt(int r, int g, int b) processSGR 38corresponding toextended set text color (foreground)with a 24 bits RGB definition of the color.Methods inherited from class org.fusesource.jansi.io.AnsiProcessor
getNextOptionInt, processChangeIconName, processChangeIconNameAndWindowTitle, processCharsetSelect, processCharsetSelect, processEscapeCommand, processOperatingSystemCommand, processScrollDown, processScrollUp, processSetBackgroundColor, processSetForegroundColor, processUnknownExtension, processUnknownOperatingSystemCommand
-
Field Details
-
console
private final long console -
FOREGROUND_BLACK
private static final short FOREGROUND_BLACK- See Also:
-
FOREGROUND_YELLOW
private static final short FOREGROUND_YELLOW -
FOREGROUND_MAGENTA
private static final short FOREGROUND_MAGENTA -
FOREGROUND_CYAN
private static final short FOREGROUND_CYAN -
FOREGROUND_WHITE
private static final short FOREGROUND_WHITE -
BACKGROUND_BLACK
private static final short BACKGROUND_BLACK- See Also:
-
BACKGROUND_YELLOW
private static final short BACKGROUND_YELLOW -
BACKGROUND_MAGENTA
private static final short BACKGROUND_MAGENTA -
BACKGROUND_CYAN
private static final short BACKGROUND_CYAN -
BACKGROUND_WHITE
private static final short BACKGROUND_WHITE -
ANSI_FOREGROUND_COLOR_MAP
private static final short[] ANSI_FOREGROUND_COLOR_MAP -
ANSI_BACKGROUND_COLOR_MAP
private static final short[] ANSI_BACKGROUND_COLOR_MAP -
info
-
originalColors
private final short originalColors -
negative
private boolean negative -
savedX
private short savedX -
savedY
private short savedY
-
-
Constructor Details
-
WindowsAnsiProcessor
- Throws:
IOException
-
WindowsAnsiProcessor
- Throws:
IOException
-
WindowsAnsiProcessor
- Throws:
IOException
-
-
Method Details
-
getConsoleInfo
- Throws:
IOException
-
applyAttribute
- Throws:
IOException
-
invertAttributeColors
private short invertAttributeColors(short attributes) -
applyCursorPosition
- Throws:
IOException
-
processEraseScreen
Description copied from class:AnsiProcessorProcessCSI n JANSI code, corresponding toED – Erase in Display- Overrides:
processEraseScreenin classAnsiProcessor- Parameters:
eraseOption- eraseOption- Throws:
IOException- IOException
-
processEraseLine
Description copied from class:AnsiProcessorProcessCSI n KANSI code, corresponding toED – Erase in Line- Overrides:
processEraseLinein classAnsiProcessor- Parameters:
eraseOption- eraseOption- Throws:
IOException- IOException
-
processCursorLeft
Description copied from class:AnsiProcessorprocessCSI n Dcorresponding toCUB – Cursor Back- Overrides:
processCursorLeftin classAnsiProcessor- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorRight
Description copied from class:AnsiProcessorprocessCSI n Ccorresponding toCUF – Cursor Forward- Overrides:
processCursorRightin classAnsiProcessor- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorDown
Description copied from class:AnsiProcessorprocessCSI n Bcorresponding toCUD – Cursor Down- Overrides:
processCursorDownin classAnsiProcessor- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorUp
Description copied from class:AnsiProcessorprocessCSI n Acorresponding toCUU – Cursor Up- Overrides:
processCursorUpin classAnsiProcessor- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorTo
Description copied from class:AnsiProcessorprocessCSI n ; m Hcorresponding toCUP – Cursor PositionorCSI n ; m fcorresponding toHVP – Horizontal and Vertical Position- Overrides:
processCursorToin classAnsiProcessor- Parameters:
row- rowcol- col- Throws:
IOException- IOException
-
processCursorToColumn
Description copied from class:AnsiProcessorprocessCSI n Gcorresponding toCHA – Cursor Horizontal Absolute- Overrides:
processCursorToColumnin classAnsiProcessor- Parameters:
x- the column- Throws:
IOException- IOException
-
processCursorUpLine
Description copied from class:AnsiProcessorprocessCSI n Fcorresponding toCPL – Cursor Previous Line- Overrides:
processCursorUpLinein classAnsiProcessor- Parameters:
count- line count- Throws:
IOException- IOException
-
processCursorDownLine
Description copied from class:AnsiProcessorprocessCSI n Ecorresponding toCNL – Cursor Next Line- Overrides:
processCursorDownLinein classAnsiProcessor- Parameters:
count- line count- Throws:
IOException- IOException
-
processSetForegroundColor
Description copied from class:AnsiProcessorprocessSGR 30-37orSGR 90-97corresponding toSet text color (foreground)either in normal mode or high intensity.- Overrides:
processSetForegroundColorin classAnsiProcessor- Parameters:
color- the text colorbright- is high intensity?- Throws:
IOException- IOException
-
processSetForegroundColorExt
Description copied from class:AnsiProcessorprocessSGR 38corresponding toextended set text color (foreground)with a palette of 255 colors.- Overrides:
processSetForegroundColorExtin classAnsiProcessor- Parameters:
paletteIndex- the text color in the palette- Throws:
IOException- IOException
-
processSetForegroundColorExt
Description copied from class:AnsiProcessorprocessSGR 38corresponding toextended set text color (foreground)with a 24 bits RGB definition of the color.- Overrides:
processSetForegroundColorExtin classAnsiProcessor- Parameters:
r- redg- greenb- blue- Throws:
IOException- IOException
-
processSetBackgroundColor
Description copied from class:AnsiProcessorprocessSGR 40-47orSGR 100-107corresponding toSet background coloreither in normal mode or high intensity.- Overrides:
processSetBackgroundColorin classAnsiProcessor- Parameters:
color- the background colorbright- is high intensity?- Throws:
IOException- IOException
-
processSetBackgroundColorExt
Description copied from class:AnsiProcessorprocessSGR 48corresponding toextended set background colorwith a palette of 255 colors.- Overrides:
processSetBackgroundColorExtin classAnsiProcessor- Parameters:
paletteIndex- the background color in the palette- Throws:
IOException- IOException
-
processSetBackgroundColorExt
Description copied from class:AnsiProcessorprocessSGR 48corresponding toextended set background colorwith a 24 bits RGB definition of the color.- Overrides:
processSetBackgroundColorExtin classAnsiProcessor- Parameters:
r- redg- greenb- blue- Throws:
IOException- IOException
-
processDefaultTextColor
Description copied from class:AnsiProcessorprocessSGR 39corresponding toDefault text color (foreground)- Overrides:
processDefaultTextColorin classAnsiProcessor- Throws:
IOException- IOException
-
processDefaultBackgroundColor
Description copied from class:AnsiProcessorprocessSGR 49corresponding toDefault background color- Overrides:
processDefaultBackgroundColorin classAnsiProcessor- Throws:
IOException- IOException
-
processAttributeReset
Description copied from class:AnsiProcessorprocessSGR 0corresponding toReset / Normal- Overrides:
processAttributeResetin classAnsiProcessor- Throws:
IOException- IOException
-
processSetAttribute
Description copied from class:AnsiProcessorprocessSGRother than0(reset),30-39(foreground),40-49(background),90-97(foreground high intensity) or100-107(background high intensity)- Overrides:
processSetAttributein classAnsiProcessor- Parameters:
attribute- attribute- Throws:
IOException- IOException- See Also:
-
processSaveCursorPosition
Description copied from class:AnsiProcessorProcessCSI sANSI code, corresponding toSCP – Save Cursor Position- Overrides:
processSaveCursorPositionin classAnsiProcessor- Throws:
IOException- IOException
-
processRestoreCursorPosition
Description copied from class:AnsiProcessorProcessCSI uANSI code, corresponding toRCP – Restore Cursor Position- Overrides:
processRestoreCursorPositionin classAnsiProcessor- Throws:
IOException- IOException
-
processInsertLine
Description copied from class:AnsiProcessorProcessCSI LANSI code, corresponding toIL – Insert Line- Overrides:
processInsertLinein classAnsiProcessor- Parameters:
optionInt- option- Throws:
IOException- IOException
-
processDeleteLine
Description copied from class:AnsiProcessorProcessCSI MANSI code, corresponding toDL – Delete Line- Overrides:
processDeleteLinein classAnsiProcessor- Parameters:
optionInt- option- Throws:
IOException- IOException
-
processChangeWindowTitle
Description copied from class:AnsiProcessorprocessOSC 2;text BELcorresponding toChange Window title- Overrides:
processChangeWindowTitlein classAnsiProcessor- Parameters:
label- window title text
-