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:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public final class WindowsAnsiPrintStream extends AnsiPrintStream
A Windows ANSI escape processor, that uses JNA to access native platform API's to change the console attributes (see Jansi native Kernel32).- Since:
- 1.7
- Author:
- Hiram Chirino, Joris Kuipers
- See Also:
WindowsAnsiOutputStream
-
-
Field Summary
-
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, WHITE, YELLOW
-
Fields inherited from class org.fusesource.jansi.FilterPrintStream
ps
-
-
Constructor Summary
Constructors Constructor Description WindowsAnsiPrintStream(java.io.PrintStream ps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
processAttributeRest()
processSGR 0
corresponding toReset / Normal
protected void
processChangeWindowTitle(java.lang.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
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
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
-
-
-
-
Constructor Detail
-
WindowsAnsiPrintStream
public WindowsAnsiPrintStream(java.io.PrintStream ps) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
processEraseScreen
protected void processEraseScreen(int eraseOption) throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI n J
ANSI code, corresponding toED – Erase in Display
- Overrides:
processEraseScreen
in classAnsiPrintStream
- Parameters:
eraseOption
- eraseOption- Throws:
java.io.IOException
- IOException
-
processEraseLine
protected void processEraseLine(int eraseOption) throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI n K
ANSI code, corresponding toED – Erase in Line
- Overrides:
processEraseLine
in classAnsiPrintStream
- Parameters:
eraseOption
- eraseOption- Throws:
java.io.IOException
- IOException
-
processCursorLeft
protected void processCursorLeft(int count) throws java.io.IOException
Description copied from class:AnsiPrintStream
processCSI n D
corresponding toCUB – Cursor Back
- Overrides:
processCursorLeft
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
java.io.IOException
- IOException
-
processCursorRight
protected void processCursorRight(int count) throws java.io.IOException
Description copied from class:AnsiPrintStream
processCSI n C
corresponding toCUF – Cursor Forward
- Overrides:
processCursorRight
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
java.io.IOException
- IOException
-
processCursorDown
protected void processCursorDown(int count) throws java.io.IOException
Description copied from class:AnsiPrintStream
processCSI n B
corresponding toCUD – Cursor Down
- Overrides:
processCursorDown
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
java.io.IOException
- IOException
-
processCursorUp
protected void processCursorUp(int count) throws java.io.IOException
Description copied from class:AnsiPrintStream
processCSI n A
corresponding toCUU – Cursor Up
- Overrides:
processCursorUp
in classAnsiPrintStream
- Parameters:
count
- count- Throws:
java.io.IOException
- IOException
-
processCursorTo
protected void processCursorTo(int row, int col) throws java.io.IOException
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:
java.io.IOException
- IOException
-
processCursorToColumn
protected void processCursorToColumn(int x) throws java.io.IOException
Description copied from class:AnsiPrintStream
processCSI n G
corresponding toCHA – Cursor Horizontal Absolute
- Overrides:
processCursorToColumn
in classAnsiPrintStream
- Parameters:
x
- the column- Throws:
java.io.IOException
- IOException
-
processSetForegroundColor
protected void processSetForegroundColor(int color, boolean bright) throws java.io.IOException
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:
java.io.IOException
- IOException
-
processSetBackgroundColor
protected void processSetBackgroundColor(int color, boolean bright) throws java.io.IOException
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:
java.io.IOException
- IOException
-
processDefaultTextColor
protected void processDefaultTextColor() throws java.io.IOException
Description copied from class:AnsiPrintStream
processSGR 39
corresponding toDefault text color (foreground)
- Overrides:
processDefaultTextColor
in classAnsiPrintStream
- Throws:
java.io.IOException
- IOException
-
processDefaultBackgroundColor
protected void processDefaultBackgroundColor() throws java.io.IOException
Description copied from class:AnsiPrintStream
processSGR 49
corresponding toDefault background color
- Overrides:
processDefaultBackgroundColor
in classAnsiPrintStream
- Throws:
java.io.IOException
- IOException
-
processAttributeRest
protected void processAttributeRest() throws java.io.IOException
Description copied from class:AnsiPrintStream
processSGR 0
corresponding toReset / Normal
- Overrides:
processAttributeRest
in classAnsiPrintStream
- Throws:
java.io.IOException
- IOException
-
processSetAttribute
protected void processSetAttribute(int attribute) throws java.io.IOException
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:
java.io.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
protected void processSaveCursorPosition() throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI s
ANSI code, corresponding toSCP – Save Cursor Position
- Overrides:
processSaveCursorPosition
in classAnsiPrintStream
- Throws:
java.io.IOException
- IOException
-
processRestoreCursorPosition
protected void processRestoreCursorPosition() throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI u
ANSI code, corresponding toRCP – Restore Cursor Position
- Overrides:
processRestoreCursorPosition
in classAnsiPrintStream
- Throws:
java.io.IOException
- IOException
-
processInsertLine
protected void processInsertLine(int optionInt) throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI L
ANSI code, corresponding toIL – Insert Line
- Overrides:
processInsertLine
in classAnsiPrintStream
- Parameters:
optionInt
- option- Throws:
java.io.IOException
- IOException
-
processDeleteLine
protected void processDeleteLine(int optionInt) throws java.io.IOException
Description copied from class:AnsiPrintStream
ProcessCSI M
ANSI code, corresponding toDL – Delete Line
- Overrides:
processDeleteLine
in classAnsiPrintStream
- Parameters:
optionInt
- option- Throws:
java.io.IOException
- IOException
-
processChangeWindowTitle
protected void processChangeWindowTitle(java.lang.String label)
Description copied from class:AnsiPrintStream
processOSC 2;text BEL
corresponding toChange Window title
- Overrides:
processChangeWindowTitle
in classAnsiPrintStream
- Parameters:
label
- window title text
-
-