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 short
private static final short
private static final short
private static final short
private static final short
private final long
private static final short
private static final short
private static final short
private static final short
private static final short
private final Kernel32.CONSOLE_SCREEN_BUFFER_INFO
private boolean
private final short
private short
private short
Fields 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 void
private void
private void
private short
invertAttributeColors
(short attributes) protected void
processSGR 0
corresponding toReset / Normal
protected void
processChangeWindowTitle
(String label) processOSC 2;text BEL
corresponding toChange Window title
protected void
processCursorDown
(int count) processCSI n B
corresponding toCUD – Cursor Down
protected void
processCursorDownLine
(int count) processCSI n E
corresponding toCNL – Cursor Next Line
protected void
processCursorLeft
(int count) processCSI n D
corresponding toCUB – Cursor Back
protected void
processCursorRight
(int count) processCSI n C
corresponding toCUF – Cursor Forward
protected void
processCursorTo
(int row, int col) processCSI n ; m H
corresponding toCUP – Cursor Position
orCSI n ; m f
corresponding toHVP – Horizontal and Vertical Position
protected void
processCursorToColumn
(int x) processCSI n G
corresponding toCHA – Cursor Horizontal Absolute
protected void
processCursorUp
(int count) processCSI n A
corresponding toCUU – Cursor Up
protected void
processCursorUpLine
(int count) processCSI n F
corresponding toCPL – Cursor Previous Line
protected void
processSGR 49
corresponding toDefault background color
protected void
processSGR 39
corresponding toDefault text color (foreground)
protected void
processDeleteLine
(int optionInt) ProcessCSI M
ANSI code, corresponding toDL – Delete Line
protected void
processEraseLine
(int eraseOption) ProcessCSI n K
ANSI code, corresponding toED – Erase in Line
protected void
processEraseScreen
(int eraseOption) ProcessCSI n J
ANSI code, corresponding toED – Erase in Display
protected void
processInsertLine
(int optionInt) ProcessCSI L
ANSI code, corresponding toIL – Insert Line
protected void
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
protected void
ProcessCSI s
ANSI code, corresponding toSCP – Save Cursor Position
protected void
processSetAttribute
(int attribute) processSGR
other than0
(reset),30-39
(foreground),40-49
(background),90-97
(foreground high intensity) or100-107
(background high intensity)protected void
processSetBackgroundColor
(int color, boolean bright) processSGR 40-47
orSGR 100-107
corresponding toSet background color
either in normal mode or high intensity.protected void
processSetBackgroundColorExt
(int paletteIndex) processSGR 48
corresponding toextended set background color
with a palette of 255 colors.protected void
processSetBackgroundColorExt
(int r, int g, int b) processSGR 48
corresponding toextended set background color
with a 24 bits RGB definition of the color.protected void
processSetForegroundColor
(int color, boolean bright) processSGR 30-37
orSGR 90-97
corresponding toSet text color (foreground)
either in normal mode or high intensity.protected void
processSetForegroundColorExt
(int paletteIndex) processSGR 38
corresponding toextended set text color (foreground)
with a palette of 255 colors.protected void
processSetForegroundColorExt
(int r, int g, int b) processSGR 38
corresponding 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:AnsiProcessor
ProcessCSI n J
ANSI code, corresponding toED – Erase in Display
- Overrides:
processEraseScreen
in classAnsiProcessor
- Parameters:
eraseOption
- eraseOption- Throws:
IOException
- IOException
-
processEraseLine
Description copied from class:AnsiProcessor
ProcessCSI n K
ANSI code, corresponding toED – Erase in Line
- Overrides:
processEraseLine
in classAnsiProcessor
- Parameters:
eraseOption
- eraseOption- Throws:
IOException
- IOException
-
processCursorLeft
Description copied from class:AnsiProcessor
processCSI n D
corresponding toCUB – Cursor Back
- Overrides:
processCursorLeft
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorRight
Description copied from class:AnsiProcessor
processCSI n C
corresponding toCUF – Cursor Forward
- Overrides:
processCursorRight
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorDown
Description copied from class:AnsiProcessor
processCSI n B
corresponding toCUD – Cursor Down
- Overrides:
processCursorDown
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorUp
Description copied from class:AnsiProcessor
processCSI n A
corresponding toCUU – Cursor Up
- Overrides:
processCursorUp
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorTo
Description copied from class:AnsiProcessor
processCSI n ; m H
corresponding toCUP – Cursor Position
orCSI n ; m f
corresponding toHVP – Horizontal and Vertical Position
- Overrides:
processCursorTo
in classAnsiProcessor
- Parameters:
row
- rowcol
- col- Throws:
IOException
- IOException
-
processCursorToColumn
Description copied from class:AnsiProcessor
processCSI n G
corresponding toCHA – Cursor Horizontal Absolute
- Overrides:
processCursorToColumn
in classAnsiProcessor
- Parameters:
x
- the column- Throws:
IOException
- IOException
-
processCursorUpLine
Description copied from class:AnsiProcessor
processCSI n F
corresponding toCPL – Cursor Previous Line
- Overrides:
processCursorUpLine
in classAnsiProcessor
- Parameters:
count
- line count- Throws:
IOException
- IOException
-
processCursorDownLine
Description copied from class:AnsiProcessor
processCSI n E
corresponding toCNL – Cursor Next Line
- Overrides:
processCursorDownLine
in classAnsiProcessor
- Parameters:
count
- line count- Throws:
IOException
- IOException
-
processSetForegroundColor
Description copied from class:AnsiProcessor
processSGR 30-37
orSGR 90-97
corresponding toSet text color (foreground)
either in normal mode or high intensity.- Overrides:
processSetForegroundColor
in classAnsiProcessor
- Parameters:
color
- the text colorbright
- is high intensity?- Throws:
IOException
- IOException
-
processSetForegroundColorExt
Description copied from class:AnsiProcessor
processSGR 38
corresponding toextended set text color (foreground)
with a palette of 255 colors.- Overrides:
processSetForegroundColorExt
in classAnsiProcessor
- Parameters:
paletteIndex
- the text color in the palette- Throws:
IOException
- IOException
-
processSetForegroundColorExt
Description copied from class:AnsiProcessor
processSGR 38
corresponding toextended set text color (foreground)
with a 24 bits RGB definition of the color.- Overrides:
processSetForegroundColorExt
in classAnsiProcessor
- Parameters:
r
- redg
- greenb
- blue- Throws:
IOException
- IOException
-
processSetBackgroundColor
Description copied from class:AnsiProcessor
processSGR 40-47
orSGR 100-107
corresponding toSet background color
either in normal mode or high intensity.- Overrides:
processSetBackgroundColor
in classAnsiProcessor
- Parameters:
color
- the background colorbright
- is high intensity?- Throws:
IOException
- IOException
-
processSetBackgroundColorExt
Description copied from class:AnsiProcessor
processSGR 48
corresponding toextended set background color
with a palette of 255 colors.- Overrides:
processSetBackgroundColorExt
in classAnsiProcessor
- Parameters:
paletteIndex
- the background color in the palette- Throws:
IOException
- IOException
-
processSetBackgroundColorExt
Description copied from class:AnsiProcessor
processSGR 48
corresponding toextended set background color
with a 24 bits RGB definition of the color.- Overrides:
processSetBackgroundColorExt
in classAnsiProcessor
- Parameters:
r
- redg
- greenb
- blue- Throws:
IOException
- IOException
-
processDefaultTextColor
Description copied from class:AnsiProcessor
processSGR 39
corresponding toDefault text color (foreground)
- Overrides:
processDefaultTextColor
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processDefaultBackgroundColor
Description copied from class:AnsiProcessor
processSGR 49
corresponding toDefault background color
- Overrides:
processDefaultBackgroundColor
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processAttributeReset
Description copied from class:AnsiProcessor
processSGR 0
corresponding toReset / Normal
- Overrides:
processAttributeReset
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processSetAttribute
Description copied from class:AnsiProcessor
processSGR
other than0
(reset),30-39
(foreground),40-49
(background),90-97
(foreground high intensity) or100-107
(background high intensity)- Overrides:
processSetAttribute
in classAnsiProcessor
- Parameters:
attribute
- attribute- Throws:
IOException
- IOException- See Also:
-
AnsiProcessor.processAttributeReset()
AnsiProcessor.processSetForegroundColor(int)
AnsiProcessor.processSetForegroundColor(int, boolean)
AnsiProcessor.processSetForegroundColorExt(int)
AnsiProcessor.processSetForegroundColorExt(int, int, int)
AnsiProcessor.processDefaultTextColor()
AnsiProcessor.processDefaultBackgroundColor()
-
processSaveCursorPosition
Description copied from class:AnsiProcessor
ProcessCSI s
ANSI code, corresponding toSCP – Save Cursor Position
- Overrides:
processSaveCursorPosition
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processRestoreCursorPosition
Description copied from class:AnsiProcessor
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
- Overrides:
processRestoreCursorPosition
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processInsertLine
Description copied from class:AnsiProcessor
ProcessCSI L
ANSI code, corresponding toIL – Insert Line
- Overrides:
processInsertLine
in classAnsiProcessor
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processDeleteLine
Description copied from class:AnsiProcessor
ProcessCSI M
ANSI code, corresponding toDL – Delete Line
- Overrides:
processDeleteLine
in classAnsiProcessor
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processChangeWindowTitle
Description copied from class:AnsiProcessor
processOSC 2;text BEL
corresponding toChange Window title
- Overrides:
processChangeWindowTitle
in classAnsiProcessor
- Parameters:
label
- window title text
-