public class AnsiPrintStream extends FilterPrintStream
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.
AnsiOutputStream| 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 String |
RESET_CODE |
protected static int |
WHITE |
protected static int |
YELLOW |
psout| Constructor and Description |
|---|
AnsiPrintStream(PrintStream ps) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected boolean |
filter(int data)
Filter the content
|
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)
Process Unknown Extension
|
protected void |
processUnknownOperatingSystemCommand(int command,
String param)
Process unknown
OSC command. |
checkError, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, write, writeappend, append, append, clearError, format, format, printf, printf, setErrorwritepublic static final String 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 AnsiPrintStream(PrintStream ps)
protected boolean filter(int data)
FilterPrintStreamfilter in class FilterPrintStreamdata - character to filtertrue if the data is not filtered then has to be printed to delegate PrintStreamprotected void processRestoreCursorPosition() throws IOException
CSI u ANSI code, corresponding to RCP – Restore Cursor PositionIOException - IOExceptionprotected void processSaveCursorPosition() throws IOException
CSI s ANSI code, corresponding to SCP – Save Cursor PositionIOException - IOExceptionprotected void processInsertLine(int optionInt) throws IOException
CSI L ANSI code, corresponding to IL – Insert LineoptionInt - optionIOException - IOExceptionprotected void processDeleteLine(int optionInt) throws IOException
CSI M ANSI code, corresponding to DL – Delete LineoptionInt - optionIOException - IOExceptionprotected void processScrollDown(int optionInt) throws IOException
CSI n T ANSI code, corresponding to SD – Scroll DownoptionInt - optionIOException - IOExceptionprotected void processScrollUp(int optionInt) throws IOException
CSI n U ANSI code, corresponding to SU – Scroll UpoptionInt - optionIOException - IOExceptionprotected void processEraseScreen(int eraseOption) throws IOException
CSI n J ANSI code, corresponding to ED – Erase in DisplayeraseOption - eraseOptionIOException - IOExceptionprotected void processEraseLine(int eraseOption) throws IOException
CSI n K ANSI code, corresponding to ED – Erase in LineeraseOption - 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 colorIOException - IOExceptionprotected void processAttributeRest() throws IOException
SGR 0 corresponding to Reset / NormalIOException - 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 Positionrow - rowcol - colIOException - IOExceptionprotected void processCursorToColumn(int x) throws IOException
CSI n G corresponding to CHA – Cursor Horizontal Absolutex - the columnIOException - IOExceptionprotected void processCursorUpLine(int count) throws IOException
CSI n F corresponding to CPL – Cursor Previous Linecount - line countIOException - IOExceptionprotected void processCursorDownLine(int count) throws IOException
CSI n E corresponding to CNL – Cursor Next Linecount - line countIOException - IOExceptionprotected void processCursorLeft(int count) throws IOException
CSI n D corresponding to CUB – Cursor Backcount - countIOException - IOExceptionprotected void processCursorRight(int count) throws IOException
CSI n C corresponding to CUF – Cursor Forwardcount - countIOException - IOExceptionprotected void processCursorDown(int count) throws IOException
CSI n B corresponding to CUD – Cursor Downcount - countIOException - IOExceptionprotected void processCursorUp(int count) throws IOException
CSI n A corresponding to CUU – Cursor Upcount - countIOException - IOExceptionprotected void processUnknownExtension(ArrayList<Object> options, int command)
options - optionscommand - commandprotected void processChangeIconNameAndWindowTitle(String label)
OSC 0;text BEL corresponding to Change Window and Icon labellabel - window title nameprotected void processChangeIconName(String label)
OSC 1;text BEL corresponding to Change Icon labellabel - icon labelprotected void processChangeWindowTitle(String label)
OSC 2;text BEL corresponding to Change Window titlelabel - window title textprotected void processUnknownOperatingSystemCommand(int command, String param)
OSC command.command - commandparam - paramprotected void processCharsetSelect(int set, char seq)
public void close()
close in interface Closeableclose in interface AutoCloseableclose in class FilterPrintStreamCopyright © 2009–2018 FuseSource, Corp.. All rights reserved.