Package hudson.console
Class LineTransformationOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- hudson.console.LineTransformationOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
ConsoleAnnotationOutputStream,LineTransformationOutputStream.Delegating
public abstract class LineTransformationOutputStream extends OutputStream
FilteringOutputStreamthat buffers text by line, so that the derived class can perform some manipulation based on the contents of the whole line.Subclass
LineTransformationOutputStream.Delegatingin the typical case that you are decorating an underlying stream.- Since:
- 1.349
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLineTransformationOutputStream.DelegatingConvenience subclass for cases where you wish to process lines being sent to an underlying stream.
-
Constructor Summary
Constructors Constructor Description LineTransformationOutputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract voideol(byte[] b, int len)Called for each end of the line.voidforceEol()Forces the EOL behavior.protected StringtrimEOL(String line)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
-
-
-
Method Detail
-
eol
protected abstract void eol(byte[] b, int len) throws IOExceptionCalled for each end of the line.- Parameters:
b- Contents of the whole line, including the EOL code like CR/LF.len- 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
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
forceEol
public void forceEol() throws IOExceptionForces the EOL behavior. Useful if the caller wants to make sure the buffered content is all processed, but without actually neither flushing nor closing the stream.- Throws:
IOException
-
-