hudson.console
Class ConsoleAnnotationOutputStream<T>

java.lang.Object
  extended by java.io.OutputStream
      extended by hudson.console.LineTransformationOutputStream
          extended by hudson.console.ConsoleAnnotationOutputStream<T>
Type Parameters:
T - Context type.
All Implemented Interfaces:
Closeable, Flushable

public class ConsoleAnnotationOutputStream<T>
extends LineTransformationOutputStream

Used to convert plain text console output (as byte sequence) + embedded annotations into HTML (as char sequence), by using ConsoleAnnotator.

Since:
1.349
Author:
Kohsuke Kawaguchi

Constructor Summary
ConsoleAnnotationOutputStream(Writer out, ConsoleAnnotator<? super T> ann, T context, Charset charset)
           
 
Method Summary
 void close()
           
protected  void eol(byte[] in, int sz)
          Called after we read the whole line of plain text, which is stored in LineTransformationOutputStream.buf.
 void flush()
           
 ConsoleAnnotator getConsoleAnnotator()
           
 
Methods inherited from class hudson.console.LineTransformationOutputStream
forceEol, trimEOL, write, write
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleAnnotationOutputStream

public ConsoleAnnotationOutputStream(Writer out,
                                     ConsoleAnnotator<? super T> ann,
                                     T context,
                                     Charset charset)
Method Detail

getConsoleAnnotator

public ConsoleAnnotator getConsoleAnnotator()

eol

protected void eol(byte[] in,
                   int sz)
            throws IOException
Called after we read the whole line of plain text, which is stored in LineTransformationOutputStream.buf. This method performs annotations and send the result to out.

Specified by:
eol in class LineTransformationOutputStream
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:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class LineTransformationOutputStream
Throws:
IOException


Copyright © 2004-2013. All Rights Reserved.