Package hudson.plugins.ansicolor
Class AnsiOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- hudson.plugins.ansicolor.AnsiOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
AnsiHtmlOutputStream
public class AnsiOutputStream extends FilterOutputStream
A ANSI output stream extracts ANSI escape codes written to an output stream. 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. Subclasses should actually perform the ANSI escape behaviors.- Since:
- 1.0
- Author:
- Hiram Chirino, Joris Kuipers
-
-
Field Summary
Fields Modifier and Type Field 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
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[]
REST_CODE
protected static int
WHITE
protected static int
YELLOW
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description AnsiOutputStream(OutputStream os)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
processAttributeRest()
protected void
processChangeIconName(String label)
protected void
processChangeIconNameAndWindowTitle(String label)
protected void
processChangeWindowTitle(String label)
protected void
processCharsetSelect(int set, char seq)
protected void
processCursorDown(int count)
protected void
processCursorDownLine(int count)
protected void
processCursorLeft(int count)
protected void
processCursorRight(int count)
protected void
processCursorTo(int row, int col)
protected void
processCursorToColumn(int x)
protected void
processCursorUp(int count)
protected void
processCursorUpLine(int count)
protected void
processDefaultBackgroundColor()
protected void
processDefaultTextColor()
protected void
processEraseLine(int eraseOption)
protected void
processEraseScreen(int eraseOption)
protected void
processRestoreCursorPosition()
protected void
processSaveCursorPosition()
protected void
processScrollDown(int optionInt)
protected void
processScrollUp(int optionInt)
protected void
processSetAttribute(int attribute)
protected void
processSetBackgroundColor(int color)
protected void
processSetBackgroundColor(int color, boolean bright)
protected void
processSetBackgroundColorExt(int paletteIndex)
protected void
processSetBackgroundColorExt(int r, int g, int b)
protected void
processSetForegroundColor(int color)
protected void
processSetForegroundColor(int color, boolean bright)
protected void
processSetForegroundColorExt(int paletteIndex)
protected void
processSetForegroundColorExt(int r, int g, int b)
protected void
processUnknownExtension(ArrayList<Object> options, int command)
protected void
processUnknownOperatingSystemCommand(int command, String param)
void
write(int data)
-
Methods inherited from class java.io.FilterOutputStream
flush, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
REST_CODE
public static final byte[] REST_CODE
-
ERASE_SCREEN_TO_END
protected static final int ERASE_SCREEN_TO_END
- See Also:
- Constant Field Values
-
ERASE_SCREEN_TO_BEGINING
protected static final int ERASE_SCREEN_TO_BEGINING
- See Also:
- Constant Field Values
-
ERASE_SCREEN
protected static final int ERASE_SCREEN
- See Also:
- Constant Field Values
-
ERASE_LINE_TO_END
protected static final int ERASE_LINE_TO_END
- See Also:
- Constant Field Values
-
ERASE_LINE_TO_BEGINING
protected static final int ERASE_LINE_TO_BEGINING
- See Also:
- Constant Field Values
-
ERASE_LINE
protected static final int ERASE_LINE
- See Also:
- Constant Field Values
-
ATTRIBUTE_INTENSITY_BOLD
protected static final int ATTRIBUTE_INTENSITY_BOLD
- See Also:
- Constant Field Values
-
ATTRIBUTE_INTENSITY_FAINT
protected static final int ATTRIBUTE_INTENSITY_FAINT
- See Also:
- Constant Field Values
-
ATTRIBUTE_ITALIC
protected static final int ATTRIBUTE_ITALIC
- See Also:
- Constant Field Values
-
ATTRIBUTE_UNDERLINE
protected static final int ATTRIBUTE_UNDERLINE
- See Also:
- Constant Field Values
-
ATTRIBUTE_BLINK_SLOW
protected static final int ATTRIBUTE_BLINK_SLOW
- See Also:
- Constant Field Values
-
ATTRIBUTE_BLINK_FAST
protected static final int ATTRIBUTE_BLINK_FAST
- See Also:
- Constant Field Values
-
ATTRIBUTE_NEGATIVE_ON
protected static final int ATTRIBUTE_NEGATIVE_ON
- See Also:
- Constant Field Values
-
ATTRIBUTE_CONCEAL_ON
protected static final int ATTRIBUTE_CONCEAL_ON
- See Also:
- Constant Field Values
-
ATTRIBUTE_UNDERLINE_DOUBLE
protected static final int ATTRIBUTE_UNDERLINE_DOUBLE
- See Also:
- Constant Field Values
-
ATTRIBUTE_INTENSITY_NORMAL
protected static final int ATTRIBUTE_INTENSITY_NORMAL
- See Also:
- Constant Field Values
-
ATTRIBUTE_UNDERLINE_OFF
protected static final int ATTRIBUTE_UNDERLINE_OFF
- See Also:
- Constant Field Values
-
ATTRIBUTE_BLINK_OFF
protected static final int ATTRIBUTE_BLINK_OFF
- See Also:
- Constant Field Values
-
ATTRIBUTE_NEGATIVE_Off
protected static final int ATTRIBUTE_NEGATIVE_Off
- See Also:
- Constant Field Values
-
ATTRIBUTE_CONCEAL_OFF
protected static final int ATTRIBUTE_CONCEAL_OFF
- See Also:
- Constant Field Values
-
BLACK
protected static final int BLACK
- See Also:
- Constant Field Values
-
RED
protected static final int RED
- See Also:
- Constant Field Values
-
GREEN
protected static final int GREEN
- See Also:
- Constant Field Values
-
YELLOW
protected static final int YELLOW
- See Also:
- Constant Field Values
-
BLUE
protected static final int BLUE
- See Also:
- Constant Field Values
-
MAGENTA
protected static final int MAGENTA
- See Also:
- Constant Field Values
-
CYAN
protected static final int CYAN
- See Also:
- Constant Field Values
-
WHITE
protected static final int WHITE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AnsiOutputStream
public AnsiOutputStream(OutputStream os)
-
-
Method Detail
-
write
public void write(int data) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
processRestoreCursorPosition
protected void processRestoreCursorPosition() throws IOException
- Throws:
IOException
-
processSaveCursorPosition
protected void processSaveCursorPosition() throws IOException
- Throws:
IOException
-
processScrollDown
protected void processScrollDown(int optionInt) throws IOException
- Throws:
IOException
-
processScrollUp
protected void processScrollUp(int optionInt) throws IOException
- Throws:
IOException
-
processEraseScreen
protected void processEraseScreen(int eraseOption) throws IOException
- Throws:
IOException
-
processEraseLine
protected void processEraseLine(int eraseOption) throws IOException
- Throws:
IOException
-
processSetAttribute
protected void processSetAttribute(int attribute) throws IOException
- Throws:
IOException
-
processSetForegroundColor
protected void processSetForegroundColor(int color) throws IOException
- Throws:
IOException
-
processSetForegroundColor
protected void processSetForegroundColor(int color, boolean bright) throws IOException
- Throws:
IOException
-
processSetForegroundColorExt
protected void processSetForegroundColorExt(int paletteIndex) throws IOException
- Throws:
IOException
-
processSetForegroundColorExt
protected void processSetForegroundColorExt(int r, int g, int b) throws IOException
- Throws:
IOException
-
processSetBackgroundColor
protected void processSetBackgroundColor(int color) throws IOException
- Throws:
IOException
-
processSetBackgroundColor
protected void processSetBackgroundColor(int color, boolean bright) throws IOException
- Throws:
IOException
-
processSetBackgroundColorExt
protected void processSetBackgroundColorExt(int paletteIndex) throws IOException
- Throws:
IOException
-
processSetBackgroundColorExt
protected void processSetBackgroundColorExt(int r, int g, int b) throws IOException
- Throws:
IOException
-
processDefaultTextColor
protected void processDefaultTextColor() throws IOException
- Throws:
IOException
-
processDefaultBackgroundColor
protected void processDefaultBackgroundColor() throws IOException
- Throws:
IOException
-
processAttributeRest
protected void processAttributeRest() throws IOException
- Throws:
IOException
-
processCursorTo
protected void processCursorTo(int row, int col) throws IOException
- Throws:
IOException
-
processCursorToColumn
protected void processCursorToColumn(int x) throws IOException
- Throws:
IOException
-
processCursorUpLine
protected void processCursorUpLine(int count) throws IOException
- Throws:
IOException
-
processCursorDownLine
protected void processCursorDownLine(int count) throws IOException
- Throws:
IOException
-
processCursorLeft
protected void processCursorLeft(int count) throws IOException
- Throws:
IOException
-
processCursorRight
protected void processCursorRight(int count) throws IOException
- Throws:
IOException
-
processCursorDown
protected void processCursorDown(int count) throws IOException
- Throws:
IOException
-
processCursorUp
protected void processCursorUp(int count) throws IOException
- Throws:
IOException
-
processUnknownExtension
protected void processUnknownExtension(ArrayList<Object> options, int command)
-
processChangeIconNameAndWindowTitle
protected void processChangeIconNameAndWindowTitle(String label)
-
processChangeIconName
protected void processChangeIconName(String label)
-
processChangeWindowTitle
protected void processChangeWindowTitle(String label)
-
processUnknownOperatingSystemCommand
protected void processUnknownOperatingSystemCommand(int command, String param)
-
processCharsetSelect
protected void processCharsetSelect(int set, char seq)
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
-