Package hudson.plugins.ansicolor
Class AnsiHtmlOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
hudson.plugins.ansicolor.AnsiOutputStream
hudson.plugins.ansicolor.AnsiHtmlOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Filters an output stream of ANSI escape sequences and emits appropriate HTML elements instead.
Overlapping ANSI attribute combinations are handled by rewinding the HTML element stack.
How the HTML is actually emitted depends on the specified
AnsiAttributeElement.Emitter.
For Jenkins, the Emitter creates ConsoleNotes as part of the stream, but for
other software or testing the HTML may be emitted otherwise.
The only thing that ties this class to Jenkins is the rather unfortunate ConsoleNote preamble/postamble
handling via state machine. Simply remove this if you plan to use this class somewhere else.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intFields inherited from class hudson.plugins.ansicolor.AnsiOutputStream
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_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, REST_CODE, WHITE, YELLOWFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionAnsiHtmlOutputStream(OutputStream os, AnsiColorMap colorMap, hudson.plugins.ansicolor.AnsiAttributeElement.Emitter emitter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidprotected voidprocessChangeIconName(String label) protected voidprocessChangeWindowTitle(String label) protected voidprocessCharsetSelect(int set, char seq) protected voidprocessCursorDown(int count) protected voidprocessCursorDownLine(int count) protected voidprocessCursorLeft(int count) protected voidprocessCursorRight(int count) protected voidprocessCursorTo(int row, int col) protected voidprocessCursorToColumn(int x) protected voidprocessCursorUp(int count) protected voidprocessCursorUpLine(int count) protected voidprotected voidprotected voidprocessEraseLine(int eraseOption) protected voidprocessEraseScreen(int eraseOption) protected voidprotected voidprotected voidprocessScrollDown(int optionInt) protected voidprocessScrollUp(int optionInt) protected voidprocessSetAttribute(int attribute) protected voidprocessSetBackgroundColor(int color) protected voidprocessSetBackgroundColor(int color, boolean bright) protected voidprocessSetBackgroundColorExt(int paletteIndex) protected voidprocessSetBackgroundColorExt(int r, int g, int b) protected voidprocessSetForegroundColor(int color) protected voidprocessSetForegroundColor(int color, boolean bright) protected voidprocessSetForegroundColorExt(int paletteIndex) protected voidprocessSetForegroundColorExt(int r, int g, int b) protected voidprocessUnknownExtension(ArrayList<Object> options, int command) protected voidprocessUnknownOperatingSystemCommand(int command, String param) voidsetBackgroundColor(String color) voidwrite(int data) Methods inherited from class hudson.plugins.ansicolor.AnsiOutputStream
processChangeIconNameAndWindowTitleMethods inherited from class java.io.FilterOutputStream
flush, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
ATTRIBUTE_STRIKEOUT
protected static final int ATTRIBUTE_STRIKEOUT- See Also:
-
ATTRIBUTE_ITALIC_OFF
protected static final int ATTRIBUTE_ITALIC_OFF- See Also:
-
ATTRIBUTE_STRIKEOUT_OFF
protected static final int ATTRIBUTE_STRIKEOUT_OFF- See Also:
-
ATTRIBUTE_FRAMED
protected static final int ATTRIBUTE_FRAMED- See Also:
-
ATTRIBUTE_ENCIRCLED
protected static final int ATTRIBUTE_ENCIRCLED- See Also:
-
ATTRIBUTE_OVERLINE
protected static final int ATTRIBUTE_OVERLINE- See Also:
-
ATTRIBUTE_FRAMED_OFF
protected static final int ATTRIBUTE_FRAMED_OFF- See Also:
-
ATTRIBUTE_OVERLINE_OFF
protected static final int ATTRIBUTE_OVERLINE_OFF- See Also:
-
-
Constructor Details
-
AnsiHtmlOutputStream
public AnsiHtmlOutputStream(OutputStream os, AnsiColorMap colorMap, hudson.plugins.ansicolor.AnsiAttributeElement.Emitter emitter)
-
-
Method Details
-
write
- Overrides:
writein classAnsiOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAnsiOutputStream- Throws:
IOException
-
setBackgroundColor
-
processSetAttribute
protected void processSetAttribute(int attribute) - Overrides:
processSetAttributein classAnsiOutputStream
-
processAttributeRest
protected void processAttributeRest()- Overrides:
processAttributeRestin classAnsiOutputStream
-
processSetForegroundColor
protected void processSetForegroundColor(int color) - Overrides:
processSetForegroundColorin classAnsiOutputStream
-
processSetForegroundColor
protected void processSetForegroundColor(int color, boolean bright) - Overrides:
processSetForegroundColorin classAnsiOutputStream
-
processSetForegroundColorExt
protected void processSetForegroundColorExt(int paletteIndex) - Overrides:
processSetForegroundColorExtin classAnsiOutputStream
-
processSetForegroundColorExt
protected void processSetForegroundColorExt(int r, int g, int b) - Overrides:
processSetForegroundColorExtin classAnsiOutputStream
-
processSetBackgroundColor
protected void processSetBackgroundColor(int color) - Overrides:
processSetBackgroundColorin classAnsiOutputStream
-
processSetBackgroundColor
protected void processSetBackgroundColor(int color, boolean bright) - Overrides:
processSetBackgroundColorin classAnsiOutputStream
-
processSetBackgroundColorExt
protected void processSetBackgroundColorExt(int paletteIndex) - Overrides:
processSetBackgroundColorExtin classAnsiOutputStream
-
processSetBackgroundColorExt
protected void processSetBackgroundColorExt(int r, int g, int b) - Overrides:
processSetBackgroundColorExtin classAnsiOutputStream
-
processDefaultTextColor
protected void processDefaultTextColor()- Overrides:
processDefaultTextColorin classAnsiOutputStream
-
processDefaultBackgroundColor
protected void processDefaultBackgroundColor()- Overrides:
processDefaultBackgroundColorin classAnsiOutputStream
-
processEraseLine
protected void processEraseLine(int eraseOption) - Overrides:
processEraseLinein classAnsiOutputStream
-
processCursorDown
protected void processCursorDown(int count) - Overrides:
processCursorDownin classAnsiOutputStream
-
processCursorUp
protected void processCursorUp(int count) - Overrides:
processCursorUpin classAnsiOutputStream
-
processCursorLeft
protected void processCursorLeft(int count) - Overrides:
processCursorLeftin classAnsiOutputStream
-
processCursorUpLine
protected void processCursorUpLine(int count) - Overrides:
processCursorUpLinein classAnsiOutputStream
-
processRestoreCursorPosition
protected void processRestoreCursorPosition()- Overrides:
processRestoreCursorPositionin classAnsiOutputStream
-
processSaveCursorPosition
protected void processSaveCursorPosition()- Overrides:
processSaveCursorPositionin classAnsiOutputStream
-
processScrollDown
protected void processScrollDown(int optionInt) - Overrides:
processScrollDownin classAnsiOutputStream
-
processScrollUp
protected void processScrollUp(int optionInt) - Overrides:
processScrollUpin classAnsiOutputStream
-
processEraseScreen
protected void processEraseScreen(int eraseOption) - Overrides:
processEraseScreenin classAnsiOutputStream
-
processCursorTo
protected void processCursorTo(int row, int col) - Overrides:
processCursorToin classAnsiOutputStream
-
processCursorToColumn
protected void processCursorToColumn(int x) - Overrides:
processCursorToColumnin classAnsiOutputStream
-
processCursorDownLine
protected void processCursorDownLine(int count) - Overrides:
processCursorDownLinein classAnsiOutputStream
-
processCursorRight
protected void processCursorRight(int count) - Overrides:
processCursorRightin classAnsiOutputStream
-
processUnknownExtension
- Overrides:
processUnknownExtensionin classAnsiOutputStream
-
processChangeIconName
- Overrides:
processChangeIconNamein classAnsiOutputStream
-
processChangeWindowTitle
- Overrides:
processChangeWindowTitlein classAnsiOutputStream
-
processUnknownOperatingSystemCommand
- Overrides:
processUnknownOperatingSystemCommandin classAnsiOutputStream
-
processCharsetSelect
protected void processCharsetSelect(int set, char seq) - Overrides:
processCharsetSelectin classAnsiOutputStream
-