New IO (nio)
Explore the Java 7 NIO API to understand its new classes and interfaces for file and file system manipulation. Learn how to use WatchService to monitor file system events and perform operations such as reading files and computing statistics on their content.
We'll cover the following...
We'll cover the following...
Classes and interfaces of NIO API
Java 7 adds several new classes and interfaces for manipulating files and file systems. This new API allows developers to access many low-level OS operations that were not available in the Java API before, such as the WatchService and the ability to create links (in Nix operating systems).
The following list defines some of the most important classes and interfaces of the NIO API:
- Files: This class consists exclusively of static methods that operate on files, directories, or other types of files.
- FileStore: Storage for files.
- FileSystem: Provides an