Documentation

The Java™ Tutorials
Hide TOC
Summary小结
Trail: Essential Java Classes
Lesson: Basic I/O

Summary小结

The java.io package contains many classes that your programs can use to read and write data. java.io包包含许多类,您的程序可以使用这些类来读写数据。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. 顺序访问流可分为两组:读写字节的访问流和读写Unicode字符的访问流。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. java.nio.file包为文件和文件系统I/O提供了广泛的支持。This is a very comprehensive API, but the key entry points are as follows:这是一个非常全面的API,但关键的入口点如下:

More information on NIO.2 can be found on the OpenJDK: NIO project website. 关于NIO.2的更多信息可以在OpenJDK: NIO项目网站上找到。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.本站点包含NIO.2提供的超出本教程范围的功能的资源,如多播、异步I/O和创建您自己的文件系统实现。


Previous page: Legacy File I/O Code
Next page: Questions and Exercises: Basic I/O