Package jetbrains.buildServer
Class LineAwareByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ByteArrayOutputStream
-
- jetbrains.buildServer.LineAwareByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class LineAwareByteArrayOutputStream extends ByteArrayOutputStream
A ByteArrayOutputStream which decodes bytes into string and invokes the given callback when a new line is detected. Can be used as outputStream inStreamGobblerto get progress from external process without waiting for process to finish. By default it accumulates written bytes (as does normal ByteArrayOutputStream), this can be disabled, so that written bytes are not accumulated, but callback is notified about detected lines. This is useful if external process reports only progress and its output can be big.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLineAwareByteArrayOutputStream.LineListener
-
Field Summary
-
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
-
-
Constructor Summary
Constructors Constructor Description LineAwareByteArrayOutputStream(Charset charset, LineAwareByteArrayOutputStream.LineListener listener)LineAwareByteArrayOutputStream(Charset charset, LineAwareByteArrayOutputStream.LineListener listener, boolean accumulateBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidsetCREndsLine(boolean CREndsLine)voidwrite(byte[] b, int off, int len)-
Methods inherited from class java.io.ByteArrayOutputStream
reset, size, toByteArray, toString, toString, toString, write, writeTo
-
Methods inherited from class java.io.OutputStream
flush, write
-
-
-
-
Constructor Detail
-
LineAwareByteArrayOutputStream
public LineAwareByteArrayOutputStream(@NotNull Charset charset, @NotNull LineAwareByteArrayOutputStream.LineListener listener)
-
LineAwareByteArrayOutputStream
public LineAwareByteArrayOutputStream(@NotNull Charset charset, @NotNull LineAwareByteArrayOutputStream.LineListener listener, boolean accumulateBytes)
-
-
Method Detail
-
setCREndsLine
public void setCREndsLine(boolean CREndsLine)
-
write
public void write(byte[] b, int off, int len)- Overrides:
writein classByteArrayOutputStream
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classByteArrayOutputStream- Throws:
IOException
-
-