Documentation

The Java™ Tutorials
Hide TOC
Basic I/O基本输入输出
Trail: Essential Java Classes

Lesson: Basic I/O课程:基本输入输出

This lesson covers the Java platform classes used for basic I/O.本课程介绍用于基本I/O的Java平台类。It first focuses on I/O Streams, a powerful concept that greatly simplifies I/O operations.它首先关注I/O流,这是一个强大的概念,可以极大地简化I/O操作。The lesson also looks at serialization, which lets a program write whole objects out to streams and read them back again.本课程还将介绍序列化,它允许程序将整个对象写入流,然后重新读取。Then the lesson looks at file I/O and file system operations, including random access files.然后,本课程将介绍文件I/O和文件系统操作,包括随机访问文件。

Most of the classes covered in the I/O Streams section are in the java.io package.I/O Streams部分中涉及的大多数类都在java.io包中。Most of the classes covered in the File I/O section are in the java.nio.file package.File I/O部分中涉及的大多数类都在java.nio.File包中。

I/O StreamsI/O流

File I/O (Featuring NIO.2)文件I/O(以NIO.2为特色)

Summary小结

A summary of the key points covered in this trail.本课程中涵盖的关键点的小结。

Questions and Exercises问题和练习

Test what you've learned in this trail by trying these questions and exercises.通过尝试以下问题和练习,测试您在这一过程中学到的知识。

The I/O Classes in ActionI/O类实操

Many of the examples in the next trail, Custom Networking use the I/O streams described in this lesson to read from and write to network connections.在下一部分中的许多示例中,自定义网络使用本课程中描述的I/O流来读取和写入网络连接。


Security consideration:安全性考虑: Some I/O operations are subject to approval by the current security manager.某些I/O操作需要经过当前安全经理的批准。The example programs contained in these lessons are standalone applications, which by default have no security manager.这些课程中包含的示例程序是独立的应用程序,默认情况下没有安全管理器。To work in an applet, most of these examples would have to be modified.要在小程序中工作,大多数示例都必须修改。See What Applets Can and Cannot Do for information about the security restrictions placed on applets.有关小程序上的安全限制的信息,请参阅小程序可以做什么和不能做什么

Previous page: Previous Lesson
Next page: I/O Streams