Use BufferedReader.lines()

Closes gh-11436
This commit is contained in:
Johnny Lim
2017-12-27 14:36:38 +09:00
committed by Stephane Nicoll
parent 50a4982a52
commit 8f7ab95e0e
6 changed files with 19 additions and 57 deletions

View File

@@ -28,6 +28,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -159,19 +160,9 @@ public final class CommandLineInvoker {
private List<String> getLines(StringBuffer buffer) {
BufferedReader reader = new BufferedReader(
new StringReader(buffer.toString()));
String line;
List<String> lines = new ArrayList<>();
try {
while ((line = reader.readLine()) != null) {
if (!line.startsWith("Picked up ")) {
lines.add(line);
}
}
}
catch (IOException ex) {
throw new RuntimeException("Failed to read output");
}
return lines;
return reader.lines()
.filter((line) -> !line.startsWith("Picked up "))
.collect(Collectors.toList());
}
public int await() throws InterruptedException {