public class AnsiOutputStream extends FilterOutputStream
process*
methods.
For more information about ANSI escape codes, see Wikipedia article
This class just filters out the escape codes so that they are not
sent out to the underlying OutputStream: process*
methods
are empty. Subclasses should actually perform the ANSI escape behaviors
by implementing active code in process*
methods.
AnsiPrintStream
Modifier and Type | Field and Description |
---|---|
protected static int |
ATTRIBUTE_BLINK_FAST |
protected static int |
ATTRIBUTE_BLINK_OFF |
protected static int |
ATTRIBUTE_BLINK_SLOW |
protected static int |
ATTRIBUTE_CONCEAL_OFF |
protected static int |
ATTRIBUTE_CONCEAL_ON |
protected static int |
ATTRIBUTE_INTENSITY_BOLD |
protected static int |
ATTRIBUTE_INTENSITY_FAINT |
protected static int |
ATTRIBUTE_INTENSITY_NORMAL |
protected static int |
ATTRIBUTE_ITALIC |
protected static int |
ATTRIBUTE_NEGATIVE_Off
Deprecated.
|
protected static int |
ATTRIBUTE_NEGATIVE_OFF |
protected static int |
ATTRIBUTE_NEGATIVE_ON |
protected static int |
ATTRIBUTE_UNDERLINE |
protected static int |
ATTRIBUTE_UNDERLINE_DOUBLE |
protected static int |
ATTRIBUTE_UNDERLINE_OFF |
protected static int |
BLACK |
protected static int |
BLUE |
protected static int |
CYAN |
protected static int |
ERASE_LINE |
protected static int |
ERASE_LINE_TO_BEGINING |
protected static int |
ERASE_LINE_TO_END |
protected static int |
ERASE_SCREEN |
protected static int |
ERASE_SCREEN_TO_BEGINING |
protected static int |
ERASE_SCREEN_TO_END |
protected static int |
GREEN |
protected static int |
MAGENTA |
protected static int |
RED |
static byte[] |
RESET_CODE |
static byte[] |
REST_CODE
Deprecated.
|
protected static int |
WHITE |
protected static int |
YELLOW |
out
Constructor and Description |
---|
AnsiOutputStream(OutputStream os) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
processAttributeRest()
process
SGR 0 corresponding to Reset / Normal |
protected void |
processChangeIconName(String label)
process
OSC 1;text BEL corresponding to Change Icon label |
protected void |
processChangeIconNameAndWindowTitle(String label)
process
OSC 0;text BEL corresponding to Change Window and Icon label |
protected void |
processChangeWindowTitle(String label)
process
OSC 2;text BEL corresponding to Change Window title |
protected void |
processCharsetSelect(int set,
char seq) |
protected void |
processCursorDown(int count)
process
CSI n B corresponding to CUD – Cursor Down |
protected void |
processCursorDownLine(int count)
process
CSI n E corresponding to CNL – Cursor Next Line |
protected void |
processCursorLeft(int count)
process
CSI n D corresponding to CUB – Cursor Back |
protected void |
processCursorRight(int count)
process
CSI n C corresponding to CUF – Cursor Forward |
protected void |
processCursorTo(int row,
int col)
process
CSI n ; m H corresponding to CUP – Cursor Position or
CSI n ; m f corresponding to HVP – Horizontal and Vertical Position |
protected void |
processCursorToColumn(int x)
process
CSI n G corresponding to CHA – Cursor Horizontal Absolute |
protected void |
processCursorUp(int count)
process
CSI n A corresponding to CUU – Cursor Up |
protected void |
processCursorUpLine(int count)
process
CSI n F corresponding to CPL – Cursor Previous Line |
protected void |
processDefaultBackgroundColor()
process
SGR 49 corresponding to Default background color |
protected void |
processDefaultTextColor()
process
SGR 39 corresponding to Default text color (foreground) |
protected void |
processDeleteLine(int optionInt)
Process
CSI M ANSI code, corresponding to DL – Delete Line |
protected void |
processEraseLine(int eraseOption)
Process
CSI n K ANSI code, corresponding to ED – Erase in Line |
protected void |
processEraseScreen(int eraseOption)
Process
CSI n J ANSI code, corresponding to ED – Erase in Display |
protected void |
processInsertLine(int optionInt)
Process
CSI L ANSI code, corresponding to IL – Insert Line |
protected void |
processRestoreCursorPosition()
Process
CSI u ANSI code, corresponding to RCP – Restore Cursor Position |
protected void |
processSaveCursorPosition()
Process
CSI s ANSI code, corresponding to SCP – Save Cursor Position |
protected void |
processScrollDown(int optionInt)
Process
CSI n T ANSI code, corresponding to SD – Scroll Down |
protected void |
processScrollUp(int optionInt)
Process
CSI n U ANSI code, corresponding to SU – Scroll Up |
protected void |
processSetAttribute(int attribute)
process
SGR other than 0 (reset), 30-39 (foreground),
40-49 (background), 90-97 (foreground high intensity) or
100-107 (background high intensity) |
protected void |
processSetBackgroundColor(int color)
process
SGR 40-47 corresponding to Set background color . |
protected void |
processSetBackgroundColor(int color,
boolean bright)
process
SGR 40-47 or SGR 100-107 corresponding to
Set background color either in normal mode or high intensity. |
protected void |
processSetBackgroundColorExt(int paletteIndex)
process
SGR 48 corresponding to extended set background color
with a palette of 255 colors. |
protected void |
processSetBackgroundColorExt(int r,
int g,
int b)
process
SGR 48 corresponding to extended set background color
with a 24 bits RGB definition of the color. |
protected void |
processSetForegroundColor(int color)
process
SGR 30-37 corresponding to Set text color (foreground) . |
protected void |
processSetForegroundColor(int color,
boolean bright)
process
SGR 30-37 or SGR 90-97 corresponding to
Set text color (foreground) either in normal mode or high intensity. |
protected void |
processSetForegroundColorExt(int paletteIndex)
process
SGR 38 corresponding to extended set text color (foreground)
with a palette of 255 colors. |
protected void |
processSetForegroundColorExt(int r,
int g,
int b)
process
SGR 38 corresponding to extended set text color (foreground)
with a 24 bits RGB definition of the color. |
protected void |
processUnknownExtension(ArrayList<Object> options,
int command) |
protected void |
processUnknownOperatingSystemCommand(int command,
String param)
Process unknown
OSC command. |
void |
write(int data) |
flush, write, write
public static final byte[] RESET_CODE
@Deprecated public static final byte[] REST_CODE
protected static final int ERASE_SCREEN_TO_END
protected static final int ERASE_SCREEN_TO_BEGINING
protected static final int ERASE_SCREEN
protected static final int ERASE_LINE_TO_END
protected static final int ERASE_LINE_TO_BEGINING
protected static final int ERASE_LINE
protected static final int ATTRIBUTE_INTENSITY_BOLD
protected static final int ATTRIBUTE_INTENSITY_FAINT
protected static final int ATTRIBUTE_ITALIC
protected static final int ATTRIBUTE_UNDERLINE
protected static final int ATTRIBUTE_BLINK_SLOW
protected static final int ATTRIBUTE_BLINK_FAST
protected static final int ATTRIBUTE_NEGATIVE_ON
protected static final int ATTRIBUTE_CONCEAL_ON
protected static final int ATTRIBUTE_UNDERLINE_DOUBLE
protected static final int ATTRIBUTE_INTENSITY_NORMAL
protected static final int ATTRIBUTE_UNDERLINE_OFF
protected static final int ATTRIBUTE_BLINK_OFF
@Deprecated protected static final int ATTRIBUTE_NEGATIVE_Off
protected static final int ATTRIBUTE_NEGATIVE_OFF
protected static final int ATTRIBUTE_CONCEAL_OFF
protected static final int BLACK
protected static final int RED
protected static final int GREEN
protected static final int YELLOW
protected static final int BLUE
protected static final int MAGENTA
protected static final int CYAN
protected static final int WHITE
public AnsiOutputStream(OutputStream os)
public void write(int data) throws IOException
write
in class FilterOutputStream
IOException
protected void processRestoreCursorPosition() throws IOException
CSI u
ANSI code, corresponding to RCP – Restore Cursor Position
IOException
- IOExceptionprotected void processSaveCursorPosition() throws IOException
CSI s
ANSI code, corresponding to SCP – Save Cursor Position
IOException
- IOExceptionprotected void processInsertLine(int optionInt) throws IOException
CSI L
ANSI code, corresponding to IL – Insert Line
optionInt
- optionIOException
- IOExceptionprotected void processDeleteLine(int optionInt) throws IOException
CSI M
ANSI code, corresponding to DL – Delete Line
optionInt
- optionIOException
- IOExceptionprotected void processScrollDown(int optionInt) throws IOException
CSI n T
ANSI code, corresponding to SD – Scroll Down
optionInt
- optionIOException
- IOExceptionprotected void processScrollUp(int optionInt) throws IOException
CSI n U
ANSI code, corresponding to SU – Scroll Up
optionInt
- optionIOException
- IOExceptionprotected void processEraseScreen(int eraseOption) throws IOException
CSI n J
ANSI code, corresponding to ED – Erase in Display
eraseOption
- eraseOptionIOException
- IOExceptionprotected void processEraseLine(int eraseOption) throws IOException
CSI n K
ANSI code, corresponding to ED – Erase in Line
eraseOption
- eraseOptionIOException
- IOExceptionprotected void processSetAttribute(int attribute) throws IOException
SGR
other than 0
(reset), 30-39
(foreground),
40-49
(background), 90-97
(foreground high intensity) or
100-107
(background high intensity)attribute
- attributeIOException
- IOExceptionprocessAttributeRest()
,
processSetForegroundColor(int)
,
processSetForegroundColor(int, boolean)
,
processSetForegroundColorExt(int)
,
processSetForegroundColorExt(int, int, int)
,
processDefaultTextColor()
,
processDefaultBackgroundColor()
protected void processSetForegroundColor(int color) throws IOException
SGR 30-37
corresponding to Set text color (foreground)
.color
- the text colorIOException
- IOExceptionprotected void processSetForegroundColor(int color, boolean bright) throws IOException
SGR 30-37
or SGR 90-97
corresponding to
Set text color (foreground)
either in normal mode or high intensity.color
- the text colorbright
- is high intensity?IOException
- IOExceptionprotected void processSetForegroundColorExt(int paletteIndex) throws IOException
SGR 38
corresponding to extended set text color (foreground)
with a palette of 255 colors.paletteIndex
- the text color in the paletteIOException
- IOExceptionprotected void processSetForegroundColorExt(int r, int g, int b) throws IOException
SGR 38
corresponding to extended set text color (foreground)
with a 24 bits RGB definition of the color.r
- redg
- greenb
- blueIOException
- IOExceptionprotected void processSetBackgroundColor(int color) throws IOException
SGR 40-47
corresponding to Set background color
.color
- the background colorIOException
- IOExceptionprotected void processSetBackgroundColor(int color, boolean bright) throws IOException
SGR 40-47
or SGR 100-107
corresponding to
Set background color
either in normal mode or high intensity.color
- the background colorbright
- is high intensity?IOException
- IOExceptionprotected void processSetBackgroundColorExt(int paletteIndex) throws IOException
SGR 48
corresponding to extended set background color
with a palette of 255 colors.paletteIndex
- the background color in the paletteIOException
- IOExceptionprotected void processSetBackgroundColorExt(int r, int g, int b) throws IOException
SGR 48
corresponding to extended set background color
with a 24 bits RGB definition of the color.r
- redg
- greenb
- blueIOException
- IOExceptionprotected void processDefaultTextColor() throws IOException
SGR 39
corresponding to Default text color (foreground)
IOException
- IOExceptionprotected void processDefaultBackgroundColor() throws IOException
SGR 49
corresponding to Default background color
IOException
- IOExceptionprotected void processAttributeRest() throws IOException
SGR 0
corresponding to Reset / Normal
IOException
- IOExceptionprotected void processCursorTo(int row, int col) throws IOException
CSI n ; m H
corresponding to CUP – Cursor Position
or
CSI n ; m f
corresponding to HVP – Horizontal and Vertical Position
row
- rowcol
- columnIOException
- IOExceptionprotected void processCursorToColumn(int x) throws IOException
CSI n G
corresponding to CHA – Cursor Horizontal Absolute
x
- the columnIOException
- IOExceptionprotected void processCursorUpLine(int count) throws IOException
CSI n F
corresponding to CPL – Cursor Previous Line
count
- line countIOException
- IOExceptionprotected void processCursorDownLine(int count) throws IOException
CSI n E
corresponding to CNL – Cursor Next Line
count
- line countIOException
- IOExceptionprotected void processCursorLeft(int count) throws IOException
CSI n D
corresponding to CUB – Cursor Back
count
- numer of characters to move leftIOException
- IOExceptionprotected void processCursorRight(int count) throws IOException
CSI n C
corresponding to CUF – Cursor Forward
count
- number of characters to move onIOException
- IOExceptionprotected void processCursorDown(int count) throws IOException
CSI n B
corresponding to CUD – Cursor Down
count
- numer of lineIOException
- IOExceptionprotected void processCursorUp(int count) throws IOException
CSI n A
corresponding to CUU – Cursor Up
count
- number of linesIOException
- IOExceptionprotected void processUnknownExtension(ArrayList<Object> options, int command)
protected void processChangeIconNameAndWindowTitle(String label)
OSC 0;text BEL
corresponding to Change Window and Icon label
label
- window labelprotected void processChangeIconName(String label)
OSC 1;text BEL
corresponding to Change Icon label
label
- icon label nameprotected void processChangeWindowTitle(String label)
OSC 2;text BEL
corresponding to Change Window title
label
- window labelprotected void processUnknownOperatingSystemCommand(int command, String param)
OSC
command.command
- commandparam
- command paramprotected void processCharsetSelect(int set, char seq)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
Copyright © 2009–2019 FuseSource, Corp.. All rights reserved.