Package org.fusesource.jansi
Class WindowsAnsiPrintStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
org.fusesource.jansi.FilterPrintStream
org.fusesource.jansi.AnsiPrintStream
org.fusesource.jansi.WindowsAnsiPrintStream
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
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.7
- See Also:
-
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 org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFO
private boolean
private final short
private short
private short
private static final long
private static final long
Fields inherited from class org.fusesource.jansi.AnsiPrintStream
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_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, RED, RESET_CODE, state, WHITE, YELLOW
Fields inherited from class org.fusesource.jansi.FilterPrintStream
ps
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
Constructors -
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
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
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
processSetForegroundColor
(int color, boolean bright) processSGR 30-37
orSGR 90-97
corresponding toSet text color (foreground)
either in normal mode or high intensity.Methods inherited from class org.fusesource.jansi.AnsiPrintStream
close, filter, processChangeIconName, processChangeIconNameAndWindowTitle, processCharsetSelect, processCursorDownLine, processCursorUpLine, processScrollDown, processScrollUp, processSetBackgroundColor, processSetBackgroundColorExt, processSetBackgroundColorExt, processSetForegroundColor, processSetForegroundColorExt, processSetForegroundColorExt, processUnknownExtension, processUnknownOperatingSystemCommand
Methods inherited from class org.fusesource.jansi.FilterPrintStream
checkError, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, write, write
Methods inherited from class java.io.PrintStream
append, append, append, clearError, format, format, printf, printf, setError, write, writeBytes
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
stdout_handle
private static final long stdout_handle -
stderr_handle
private static final long stderr_handle -
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
private final org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFO info -
originalColors
private final short originalColors -
negative
private boolean negative -
savedX
private short savedX -
savedY
private short savedY
-
-
Constructor Details
-
WindowsAnsiPrintStream
- Throws:
IOException
-
WindowsAnsiPrintStream
- Throws:
IOException
-
-
Method Details
-
getConsoleInfo
- Throws:
IOException
-
applyAttribute
- Throws:
IOException
-
invertAttributeColors
private short invertAttributeColors(short attributes) -
applyCursorPosition
- Throws:
IOException
-
processEraseScreen
Description copied from class:AnsiPrintStream
ProcessCSI n J
ANSI code, corresponding toED – Erase in Display
- Overrides:
processEraseScreen
in classAnsiPrintStream
- Parameters:
eraseOption
- eraseOption- Throws:
IOException
- IOException
-
processEraseLine
Description copied from class:AnsiPrintStream
ProcessCSI n K
ANSI code, corresponding toED – Erase in Line
- Overrides:
processEraseLine
in classAnsiPrintStream
- Parameters:
eraseOption
- eraseOption- Throws:
IOException
- IOException
-
processCursorLeft
Description copied from class:AnsiPrintStream
processCSI n D
corresponding toCUB – Cursor Back
- Overrides:
processCursorLeft
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorRight
Description copied from class:AnsiPrintStream
processCSI n C
corresponding toCUF – Cursor Forward
- Overrides:
processCursorRight
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorDown
Description copied from class:AnsiPrintStream
processCSI n B
corresponding toCUD – Cursor Down
- Overrides:
processCursorDown
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorUp
Description copied from class:AnsiPrintStream
processCSI n A
corresponding toCUU – Cursor Up
- Overrides:
processCursorUp
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
IOException
- IOException
-
processCursorTo
Description copied from class:AnsiPrintStream
processCSI n ; m H
corresponding toCUP – Cursor Position
orCSI n ; m f
corresponding toHVP – Horizontal and Vertical Position
- Overrides:
processCursorTo
in classAnsiPrintStream
- Parameters:
row
- rowcol
- col- Throws:
IOException
- IOException
-
processCursorToColumn
Description copied from class:AnsiPrintStream
processCSI n G
corresponding toCHA – Cursor Horizontal Absolute
- Overrides:
processCursorToColumn
in classAnsiPrintStream
- Parameters:
x
- the column- Throws:
IOException
- IOException
-
processSetForegroundColor
Description copied from class:AnsiPrintStream
processSGR 30-37
orSGR 90-97
corresponding toSet text color (foreground)
either in normal mode or high intensity.- Overrides:
processSetForegroundColor
in classAnsiPrintStream
- Parameters:
color
- the text colorbright
- is high intensity?- Throws:
IOException
- IOException
-
processSetBackgroundColor
Description copied from class:AnsiPrintStream
processSGR 40-47
orSGR 100-107
corresponding toSet background color
either in normal mode or high intensity.- Overrides:
processSetBackgroundColor
in classAnsiPrintStream
- Parameters:
color
- the background colorbright
- is high intensity?- Throws:
IOException
- IOException
-
processDefaultTextColor
Description copied from class:AnsiPrintStream
processSGR 39
corresponding toDefault text color (foreground)
- Overrides:
processDefaultTextColor
in classAnsiPrintStream
- Throws:
IOException
- IOException
-
processDefaultBackgroundColor
Description copied from class:AnsiPrintStream
processSGR 49
corresponding toDefault background color
- Overrides:
processDefaultBackgroundColor
in classAnsiPrintStream
- Throws:
IOException
- IOException
-
processAttributeRest
Description copied from class:AnsiPrintStream
processSGR 0
corresponding toReset / Normal
- Overrides:
processAttributeRest
in classAnsiPrintStream
- Throws:
IOException
- IOException
-
processSetAttribute
Description copied from class:AnsiPrintStream
processSGR
other than0
(reset),30-39
(foreground),40-49
(background),90-97
(foreground high intensity) or100-107
(background high intensity)- Overrides:
processSetAttribute
in classAnsiPrintStream
- Parameters:
attribute
- attribute- Throws:
IOException
- IOException- See Also:
-
AnsiPrintStream.processAttributeRest()
AnsiPrintStream.processSetForegroundColor(int)
AnsiPrintStream.processSetForegroundColor(int, boolean)
AnsiPrintStream.processSetForegroundColorExt(int)
AnsiPrintStream.processSetForegroundColorExt(int, int, int)
AnsiPrintStream.processDefaultTextColor()
AnsiPrintStream.processDefaultBackgroundColor()
-
processSaveCursorPosition
Description copied from class:AnsiPrintStream
ProcessCSI s
ANSI code, corresponding toSCP – Save Cursor Position
- Overrides:
processSaveCursorPosition
in classAnsiPrintStream
- Throws:
IOException
- IOException
-
processRestoreCursorPosition
Description copied from class:AnsiPrintStream
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
- Overrides:
processRestoreCursorPosition
in classAnsiPrintStream
- Throws:
IOException
- IOException
-
processInsertLine
Description copied from class:AnsiPrintStream
ProcessCSI L
ANSI code, corresponding toIL – Insert Line
- Overrides:
processInsertLine
in classAnsiPrintStream
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processDeleteLine
Description copied from class:AnsiPrintStream
ProcessCSI M
ANSI code, corresponding toDL – Delete Line
- Overrides:
processDeleteLine
in classAnsiPrintStream
- Parameters:
optionInt
- option- Throws:
IOException
- IOException
-
processChangeWindowTitle
Description copied from class:AnsiPrintStream
processOSC 2;text BEL
corresponding toChange Window title
- Overrides:
processChangeWindowTitle
in classAnsiPrintStream
- Parameters:
label
- window title text
-