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:
write
in classOutputStream
-
flush
public void flush()- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
-
printAndReset
private void printAndReset()
-