OnJava8-Examples/files/ReadLineStream.java

19 lines
495 B
Java
Raw Normal View History

2015-12-06 11:45:16 -08:00
// files/ReadLineStream.java
// (c)2021 MindView LLC: see Copyright.txt
2015-12-06 11:45:16 -08:00
// We make no guarantees that this code is fit for any purpose.
2016-09-23 13:23:35 -06:00
// Visit http://OnJava8.com for more book information.
2015-12-06 11:45:16 -08:00
import java.nio.file.*;
public class ReadLineStream {
2016-01-25 18:05:55 -08:00
public static void
main(String[] args) throws Exception {
2015-12-06 11:45:16 -08:00
Files.lines(Paths.get("PathInfo.java"))
.skip(13)
.findFirst()
.ifPresent(System.out::println);
}
}
/* Output:
2016-07-22 14:45:35 -06:00
show("RegularFile", Files.isRegularFile(p));
2015-12-06 11:45:16 -08:00
*/