Package org.fusesource.jansi.io
Class WindowsAnsiProcessor
- java.lang.Object
-
- org.fusesource.jansi.io.AnsiProcessor
-
- org.fusesource.jansi.io.WindowsAnsiProcessor
-
public final class WindowsAnsiProcessor extends AnsiProcessor
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 RuntimeLibrary
- Since:
- 1.19
- Author:
- Hiram Chirino, Joris Kuipers
-
-
Field Summary
-
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
Constructors Constructor Description WindowsAnsiProcessor(OutputStream ps)
WindowsAnsiProcessor(OutputStream ps, boolean stdout)
WindowsAnsiProcessor(OutputStream ps, long console)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
processAttributeReset()
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
processDefaultBackgroundColor()
processSGR 49
corresponding toDefault background color
protected void
processDefaultTextColor()
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
processRestoreCursorPosition()
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
protected void
processSaveCursorPosition()
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
-
-
-
-
Constructor Detail
-
WindowsAnsiProcessor
public WindowsAnsiProcessor(OutputStream ps, long console) throws IOException
- Throws:
IOException
-
WindowsAnsiProcessor
public WindowsAnsiProcessor(OutputStream ps, boolean stdout) throws IOException
- Throws:
IOException
-
WindowsAnsiProcessor
public WindowsAnsiProcessor(OutputStream ps) throws IOException
- Throws:
IOException
-
-
Method Detail
-
processEraseScreen
protected void processEraseScreen(int eraseOption) throws IOException
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
protected void processEraseLine(int eraseOption) throws IOException
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
protected void processCursorLeft(int count) throws IOException
Description copied from class:AnsiProcessor
processCSI n D
corresponding toCUB – Cursor Back
- Overrides:
processCursorLeft
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorRight
protected void processCursorRight(int count) throws IOException
Description copied from class:AnsiProcessor
processCSI n C
corresponding toCUF – Cursor Forward
- Overrides:
processCursorRight
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorDown
protected void processCursorDown(int count) throws IOException
Description copied from class:AnsiProcessor
processCSI n B
corresponding toCUD – Cursor Down
- Overrides:
processCursorDown
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorUp
protected void processCursorUp(int count) throws IOException
Description copied from class:AnsiProcessor
processCSI n A
corresponding toCUU – Cursor Up
- Overrides:
processCursorUp
in classAnsiProcessor
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorTo
protected void processCursorTo(int row, int col) throws IOException
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
protected void processCursorToColumn(int x) throws IOException
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
protected void processCursorUpLine(int count) throws IOException
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
protected void processCursorDownLine(int count) throws IOException
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
protected void processSetForegroundColor(int color, boolean bright) throws IOException
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
protected void processSetForegroundColorExt(int paletteIndex) throws IOException
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
protected void processSetForegroundColorExt(int r, int g, int b) throws IOException
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
protected void processSetBackgroundColor(int color, boolean bright) throws IOException
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
protected void processSetBackgroundColorExt(int paletteIndex) throws IOException
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
protected void processSetBackgroundColorExt(int r, int g, int b) throws IOException
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
protected void processDefaultTextColor() throws IOException
Description copied from class:AnsiProcessor
processSGR 39
corresponding toDefault text color (foreground)
- Overrides:
processDefaultTextColor
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processDefaultBackgroundColor
protected void processDefaultBackgroundColor() throws IOException
Description copied from class:AnsiProcessor
processSGR 49
corresponding toDefault background color
- Overrides:
processDefaultBackgroundColor
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processAttributeReset
protected void processAttributeReset() throws IOException
Description copied from class:AnsiProcessor
processSGR 0
corresponding toReset / Normal
- Overrides:
processAttributeReset
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processSetAttribute
protected void processSetAttribute(int attribute) throws IOException
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
protected void processSaveCursorPosition() throws IOException
Description copied from class:AnsiProcessor
ProcessCSI s
ANSI code, corresponding toSCP – Save Cursor Position
- Overrides:
processSaveCursorPosition
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processRestoreCursorPosition
protected void processRestoreCursorPosition() throws IOException
Description copied from class:AnsiProcessor
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
- Overrides:
processRestoreCursorPosition
in classAnsiProcessor
- Throws:
IOException
- IOException
-
processInsertLine
protected void processInsertLine(int optionInt) throws IOException
Description copied from class:AnsiProcessor
ProcessCSI L
ANSI code, corresponding toIL – Insert Line
- Overrides:
processInsertLine
in classAnsiProcessor
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processDeleteLine
protected void processDeleteLine(int optionInt) throws IOException
Description copied from class:AnsiProcessor
ProcessCSI M
ANSI code, corresponding toDL – Delete Line
- Overrides:
processDeleteLine
in classAnsiProcessor
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processChangeWindowTitle
protected void processChangeWindowTitle(String label)
Description copied from class:AnsiProcessor
processOSC 2;text BEL
corresponding toChange Window title
- Overrides:
processChangeWindowTitle
in classAnsiProcessor
- Parameters:
label
- window title text
-
-