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 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 org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFOprivate booleanprivate final shortprivate shortprivate shortprivate static final longprivate static final longFields inherited from class 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, YELLOWFields inherited from class FilterPrintStream
psFields inherited from class FilterOutputStream
out -
Constructor Summary
Constructors -
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 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 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 voidprocessSetForegroundColor(int color, boolean bright) processSGR 30-37orSGR 90-97corresponding toSet text color (foreground)either in normal mode or high intensity.Methods inherited from class AnsiPrintStream
close, filter, processChangeIconName, processChangeIconNameAndWindowTitle, processCharsetSelect, processCursorDownLine, processCursorUpLine, processScrollDown, processScrollUp, processSetBackgroundColor, processSetBackgroundColorExt, processSetBackgroundColorExt, processSetForegroundColor, processSetForegroundColorExt, processSetForegroundColorExt, processUnknownExtension, processUnknownOperatingSystemCommandMethods inherited from class FilterPrintStream
checkError, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, write, writeMethods inherited from class PrintStream
append, append, append, charset, clearError, format, format, printf, printf, setError, write, writeBytesMethods inherited from class 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:AnsiPrintStreamProcessCSI n JANSI code, corresponding toED – Erase in Display- Overrides:
processEraseScreenin classAnsiPrintStream- Parameters:
eraseOption- eraseOption- Throws:
IOException- IOException
-
processEraseLine
Description copied from class:AnsiPrintStreamProcessCSI n KANSI code, corresponding toED – Erase in Line- Overrides:
processEraseLinein classAnsiPrintStream- Parameters:
eraseOption- eraseOption- Throws:
IOException- IOException
-
processCursorLeft
Description copied from class:AnsiPrintStreamprocessCSI n Dcorresponding toCUB – Cursor Back- Overrides:
processCursorLeftin classAnsiPrintStream- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorRight
Description copied from class:AnsiPrintStreamprocessCSI n Ccorresponding toCUF – Cursor Forward- Overrides:
processCursorRightin classAnsiPrintStream- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorDown
Description copied from class:AnsiPrintStreamprocessCSI n Bcorresponding toCUD – Cursor Down- Overrides:
processCursorDownin classAnsiPrintStream- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorUp
Description copied from class:AnsiPrintStreamprocessCSI n Acorresponding toCUU – Cursor Up- Overrides:
processCursorUpin classAnsiPrintStream- Parameters:
count- count- Throws:
IOException- IOException
-
processCursorTo
Description copied from class:AnsiPrintStreamprocessCSI n ; m Hcorresponding toCUP – Cursor PositionorCSI n ; m fcorresponding toHVP – Horizontal and Vertical Position- Overrides:
processCursorToin classAnsiPrintStream- Parameters:
row- rowcol- col- Throws:
IOException- IOException
-
processCursorToColumn
Description copied from class:AnsiPrintStreamprocessCSI n Gcorresponding toCHA – Cursor Horizontal Absolute- Overrides:
processCursorToColumnin classAnsiPrintStream- Parameters:
x- the column- Throws:
IOException- IOException
-
processSetForegroundColor
Description copied from class:AnsiPrintStreamprocessSGR 30-37orSGR 90-97corresponding toSet text color (foreground)either in normal mode or high intensity.- Overrides:
processSetForegroundColorin classAnsiPrintStream- Parameters:
color- the text colorbright- is high intensity?- Throws:
IOException- IOException
-
processSetBackgroundColor
Description copied from class:AnsiPrintStreamprocessSGR 40-47orSGR 100-107corresponding toSet background coloreither in normal mode or high intensity.- Overrides:
processSetBackgroundColorin classAnsiPrintStream- Parameters:
color- the background colorbright- is high intensity?- Throws:
IOException- IOException
-
processDefaultTextColor
Description copied from class:AnsiPrintStreamprocessSGR 39corresponding toDefault text color (foreground)- Overrides:
processDefaultTextColorin classAnsiPrintStream- Throws:
IOException- IOException
-
processDefaultBackgroundColor
Description copied from class:AnsiPrintStreamprocessSGR 49corresponding toDefault background color- Overrides:
processDefaultBackgroundColorin classAnsiPrintStream- Throws:
IOException- IOException
-
processAttributeRest
Description copied from class:AnsiPrintStreamprocessSGR 0corresponding toReset / Normal- Overrides:
processAttributeRestin classAnsiPrintStream- Throws:
IOException- IOException
-
processSetAttribute
Description copied from class:AnsiPrintStreamprocessSGRother than0(reset),30-39(foreground),40-49(background),90-97(foreground high intensity) or100-107(background high intensity)- Overrides:
processSetAttributein classAnsiPrintStream- Parameters:
attribute- attribute- Throws:
IOException- IOException- See Also:
-
processSaveCursorPosition
Description copied from class:AnsiPrintStreamProcessCSI sANSI code, corresponding toSCP – Save Cursor Position- Overrides:
processSaveCursorPositionin classAnsiPrintStream- Throws:
IOException- IOException
-
processRestoreCursorPosition
Description copied from class:AnsiPrintStreamProcessCSI uANSI code, corresponding toRCP – Restore Cursor Position- Overrides:
processRestoreCursorPositionin classAnsiPrintStream- Throws:
IOException- IOException
-
processInsertLine
Description copied from class:AnsiPrintStreamProcessCSI LANSI code, corresponding toIL – Insert Line- Overrides:
processInsertLinein classAnsiPrintStream- Parameters:
optionInt- option- Throws:
IOException- IOException
-
processDeleteLine
Description copied from class:AnsiPrintStreamProcessCSI MANSI code, corresponding toDL – Delete Line- Overrides:
processDeleteLinein classAnsiPrintStream- Parameters:
optionInt- option- Throws:
IOException- IOException
-
processChangeWindowTitle
Description copied from class:AnsiPrintStreamprocessOSC 2;text BELcorresponding toChange Window title- Overrides:
processChangeWindowTitlein classAnsiPrintStream- Parameters:
label- window title text
-