Package hudson.console
Class ConsoleAnnotationOutputStream<T>
- java.lang.Object
-
- java.io.OutputStream
-
- hudson.console.LineTransformationOutputStream
-
- hudson.console.ConsoleAnnotationOutputStream<T>
-
- Type Parameters:
T- Context type.
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class ConsoleAnnotationOutputStream<T> extends LineTransformationOutputStream
Used to convert plain text console output (as byte sequence) + embedded annotations into HTML (as char sequence), by usingConsoleAnnotator.- Since:
- 1.349
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.console.LineTransformationOutputStream
LineTransformationOutputStream.Delegating
-
-
Constructor Summary
Constructors Constructor Description ConsoleAnnotationOutputStream(Writer out, ConsoleAnnotator<? super T> ann, T context, Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voideol(byte[] in, int sz)Called after we read the whole line of plain text, which is stored inLineTransformationOutputStream.buf.voidflush()ConsoleAnnotator<T>getConsoleAnnotator()-
Methods inherited from class hudson.console.LineTransformationOutputStream
forceEol, trimEOL, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
ConsoleAnnotationOutputStream
public ConsoleAnnotationOutputStream(Writer out, ConsoleAnnotator<? super T> ann, T context, Charset charset)
-
-
Method Detail
-
getConsoleAnnotator
public ConsoleAnnotator<T> getConsoleAnnotator()
-
eol
protected void eol(byte[] in, int sz) throws IOExceptionCalled after we read the whole line of plain text, which is stored inLineTransformationOutputStream.buf. This method performs annotations and send the result toout.- Specified by:
eolin classLineTransformationOutputStream- Parameters:
in- Contents of the whole line, including the EOL code like CR/LF.sz- Specifies the length of the valid contents in 'b'. The rest is garbage. This is so that the caller doesn't have to allocate an array of the exact size.- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classLineTransformationOutputStream- Throws:
IOException
-
-