Use Files.readAllLines

This commit is contained in:
Paul Campbell 2018-05-15 19:50:16 +01:00
parent 2934bb11ea
commit 604acf2509

View file

@ -32,7 +32,6 @@ import java.nio.file.Path;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* Writes the README file. * Writes the README file.
@ -95,9 +94,7 @@ class ReadmeWriter implements CommandLineRunner {
} }
private String readFile(final Path file) throws IOException { private String readFile(final Path file) throws IOException {
try (Stream<String> lines = Files.lines(file, StandardCharsets.UTF_8)) { return String.join(NEWLINE, Files.readAllLines(file, StandardCharsets.UTF_8));
return lines.collect(Collectors.joining(NEWLINE));
}
} }
} }