Class OutputCollector
- java.lang.Object
-
- com.bmuschko.gradle.docker.internal.OutputCollector
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class OutputCollector extends Object implements Closeable
A utility class that will collect strings until a new line is encountered.
-
-
Constructor Summary
Constructors Constructor Description OutputCollector(Consumer<String> output)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(String input)
Accept a string as input.void
close()
-
-
-
Method Detail
-
accept
public void accept(String input)
Accept a string as input. The collector will save the inputs until a new line is encountered, or the collector is closed. The newlines are stripped and not present in the output.- Parameters:
input
- The string to accept.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-