public class AnsiOutputStream extends FilterOutputStream
process* methods.
For more information about ANSI escape codes, see:
http://en.wikipedia.org/wiki/ANSI_escape_code
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.| 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 |
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 |
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 s 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 s 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, writepublic static final byte[] RESET_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 FilterOutputStreamIOExceptionprotected void processRestoreCursorPosition()
throws IOException
CSI u ANSI code, corresponding to RCP – Restore Cursor PositionIOExceptionprotected void processSaveCursorPosition()
throws IOException
CSI s ANSI code, corresponding to SCP – Save Cursor PositionIOExceptionprotected void processInsertLine(int optionInt)
throws IOException
CSI s ANSI code, corresponding to IL – Insert LineIOExceptionprotected void processDeleteLine(int optionInt)
throws IOException
CSI s ANSI code, corresponding to DL – Delete LineIOExceptionprotected void processScrollDown(int optionInt)
throws IOException
CSI n T ANSI code, corresponding to SD – Scroll DownIOExceptionprotected void processScrollUp(int optionInt)
throws IOException
CSI n U ANSI code, corresponding to SU – Scroll UpIOExceptionprotected void processEraseScreen(int eraseOption)
throws IOException
CSI n J ANSI code, corresponding to ED – Erase in DisplayIOExceptionprotected void processEraseLine(int eraseOption)
throws IOException
CSI n K ANSI code, corresponding to ED – Erase in LineIOExceptionprotected 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)protected void processSetForegroundColor(int color)
throws IOException
SGR 30-37 corresponding to Set text color (foreground).color - the text colorIOExceptionprotected 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?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 paletteIOExceptionprotected 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 - blueIOExceptionprotected void processSetBackgroundColor(int color)
throws IOException
SGR 40-47 corresponding to Set background color.color - the background colorIOExceptionprotected 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?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 paletteIOExceptionprotected 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 - blueIOExceptionprotected void processDefaultTextColor()
throws IOException
SGR 39 corresponding to Default text color (foreground)IOExceptionprotected void processDefaultBackgroundColor()
throws IOException
SGR 49 corresponding to Default background colorIOExceptionprotected void processAttributeRest()
throws IOException
SGR 0 corresponding to Reset / NormalIOExceptionprotected 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 Positionrow - col - IOExceptionprotected void processCursorToColumn(int x)
throws IOException
CSI n G corresponding to CHA – Cursor Horizontal Absolutex - the columnIOExceptionprotected void processCursorUpLine(int count)
throws IOException
CSI n F corresponding to CPL – Cursor Previous Linecount - line countIOExceptionprotected void processCursorDownLine(int count)
throws IOException
CSI n E corresponding to CNL – Cursor Next Linecount - line countIOExceptionprotected void processCursorLeft(int count)
throws IOException
CSI n D corresponding to CUB – Cursor Backcount - IOExceptionprotected void processCursorRight(int count)
throws IOException
CSI n C corresponding to CUF – Cursor Forwardcount - IOExceptionprotected void processCursorDown(int count)
throws IOException
CSI n B corresponding to CUD – Cursor Downcount - IOExceptionprotected void processCursorUp(int count)
throws IOException
CSI n A corresponding to CUU – Cursor Upcount - IOExceptionprotected void processUnknownExtension(ArrayList<Object> options, int command)
protected void processChangeIconNameAndWindowTitle(String label)
OSC 0;text BEL corresponding to Change Window and Icon labellabel - IOExceptionprotected void processChangeIconName(String label)
OSC 1;text BEL corresponding to Change Icon labellabel - IOExceptionprotected void processChangeWindowTitle(String label)
OSC 2;text BEL corresponding to Change Window titlelabel - IOExceptionprotected void processUnknownOperatingSystemCommand(int command,
String param)
OSC command.command - param - public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOExceptionCopyright © 2020. All rights reserved.