What's the best way to read a line from a file using the New I/O ?
I can only get a byte at a time.
Any idea?
Or for small files you can do this:
List<String> smallFilesLines = Files.readAllLines(
FileSystems.getDefault().getPath("smallFile.txt"), StandardCharsets.UTF_8);
for (String oneLine : smallFilesLines) {
System.out.println(oneLine);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With