Java IO Introduction
Most applications need to process some input and produce some output based on that input.
The purpose of the Java IO package (java.io
) is to make that possible in Java.
大多数的应用往往需要访问一些输入,并且根据输入来产生相应的输出。Java IO包使这一切在java中变得可能。
If you look at the Java IO classes in the java.io
package the vast amount
of choices can be rather confusing. What is the purpose of all these classes? Which one
should you choose for a given task? How do you create your own classes to plugin? etc.
The purpose of this tutorial is to try to give you an overview of how all these classes
are grouped, and the purpose behind them, so you don't have to wonder whether you chose
the right class, or whether a class already exists for your purpose.
如果你浏览过Java IO包,其下大量可供选择的类一定让你觉得相当困惑和混淆:到底这些类都是应用在什么场合呢?对于一种特定的情况我们因该如何选择适合自己的类?如何创建一个自定义的类作为插件使用呢?....
本教程的目标就是希望通过本教程对于IO的概述,可以对如何选择一个恰当的类,某一个既定类是否满足你的需求做出判断。
The Scope of the Java IO (java.io) Package
The java.io
package doesn't actually address all types of input and output.
For instance, input from and output to a GUI or web page is not covered in the Java IO package.
Those types of input are covered elsewhere, for instance by the JFC classes in the Swing project,
or the Servlet and HTTP packages in the Java Enterprise Edition.
The Java IO package is primarily focused on input and output to files, network streams, internal memory
buffers etc.
事实上,java.io包并不能解决所有类型的输入、输出。比如说,基于GUI和web页面的输入、输出就不在java.io包的处理范围内。这些类型的输入、输出在其他方面比如Swing里面的JFC类,Servlet,java企业版里面的HTTP包被解决。
Java IO包主要关注文件的输入、输出,网络流以及内存缓冲等。
The Scope of this Java IO Tutorial
Below is a table of contents of the topics and classes covered in this tutorial. The coverage
of the classes is not just an API listing. You can get that from Sun's official Java Doc's.
Rather each text is a short introduction to the class, its purpose, and a few examples
of how to use it. In other words, some of the stuff you don't find in Sun's official Java Doc's.
下面的表格列出了本教程中涵盖的内容标题和类,这不仅仅是一个API的list。