Package org.codehaus.mojo.exec
Class LineRedirectOutputStream
java.lang.Object
java.io.OutputStream
org.codehaus.mojo.exec.LineRedirectOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An output stream that captures one line of output at a time, and then
redirects that line to some
Consumer to act upon as it pleases. This
class is not thread safe and expects to have only one active writer consuming
it at any given time.- Since:
- 3.0.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLineRedirectOutputStream(Consumer<String> linePrinter) LineRedirectOutputStream(Consumer<String> linePrinter, Charset charset) -
Method Summary
Methods inherited from class java.io.OutputStream
write, write
-
Field Details
-
linePrinter
-
charset
-
buffer
-
-
Constructor Details
-
LineRedirectOutputStream
-
LineRedirectOutputStream
-
-
Method Details
-
write
public void write(int b) - Specified by:
writein classOutputStream
-
flush
public void flush()- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
printAndReset
private void printAndReset()
-