Chapter    12

Improved File System Interface

NIO.2 improves the file system interface that was previously limited to the java.io.File class. This chapter introduces the improved file system interface’s architecture and shows you how to use the new APIs to accomplish a wide range of file system tasks.

Note  A file system manages files, which are classified as regular files, directories, symbolic links (https://en.wikipedia.org/wiki/Symbolic_link), and hard links (https://en.wikipedia.org/wiki/Hard_link).

Architecting a Better File Class

The File-based file system interface is problematic. Several problems are listed here:

  • Many methods return Boolean values rather than throw exceptions. As a result, you don’t know why an operation fails. For example, ...

Get Java I/O, NIO and NIO.2 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.