CHAPTER 10

image

Java File I/O (NIO.2)

Certification Objectives

Use Path interface to operate on file and directory paths

Use Files class to check, read, delete, copy, move, manage metadata of a file or directory

Use Stream API with NIO.2

Java offers a rich set of APIs you can use to manipulate files and directories. Java 7 introduced a set of I/O APIs called NIO.2 that offered convenient ways to perform operations related to a file system. In Java 8, you can use the Stream API (discussed in Chapter 6) with NIO.2.

The previous chapter covered I/O fundamentals; you learned how to read and write from the console and how to use streams to read and write ...

Get Oracle Certified Professional Java SE 8 Programmer Exam 1Z0-809: A Comprehensive OCPJP 8 Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.