The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
The java.io
package contains many classes that your programs can use to read and write data. Most of the classes implement sequential access streams. The sequential access streams can be divided into two groups: those that read and write bytes and those that read and write Unicode characters. Each sequential access stream has a speciality, such as reading from or writing to a file, filtering data as its read or written, or serializing an object.
The java.nio.file
package provides extensive support for file and file system I/O. This is a very comprehensive API, but the key entry points are as follows:
Path
class has methods for manipulating a path.Files
class has methods for file operations, such as moving, copy, deleting, and also methods for retrieving and setting file attributes.FileSystem
class has a variety of methods for obtaining information about the file system.More information on NIO.2 can be found on the OpenJDK: NIO project website. This site includes resources for features provided by NIO.2 that are beyond the scope of this tutorial, such as multicasting, asynchronous I/O, and creating your own file system implementation.