Please explain the use of Java's InputStream
and OutputStream
classes. I'm confused.
请解释Java的InputStream和OutputStream类的使用。我糊涂了。
3 个解决方案
#1
1
The goal of InputStream and OutputStream is to abstract different ways to input and output: whether the stream is a file, a web page, or the screen shouldn't matter. All that matters is that you receive information from the stream (or send information into that stream.)
InputStream和OutputStream的目标是抽象输入和输出的不同方式:流是文件,网页还是屏幕无关紧要。重要的是您从流中接收信息(或将信息发送到该流中)。
InputStream is used for many things that you read from.
InputStream用于您读取的许多内容。
OutputStream is used for many things that you write to.
OutputStream用于您编写的许多内容。
#2
2
You can't get better explanation than this.
你无法得到比这更好的解释。
Summary:
InputStream: The abstract class; superclass of all classes representing an input stream of bytes.
InputStream:抽象类;表示输入字节流的所有类的超类。
OutputStream: This abstract class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.
OutputStream:此抽象类是表示输出字节流的所有类的超类。输出流接受输出字节并将它们发送到某个接收器。
Some more details are available here.
这里有更多细节。
To know about Character Streams, see here and here.
要了解Character Streams,请参阅此处和此处。
#3
-1
An I/O Stream represents an input source or an output destination. A stream can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays.
I / O流表示输入源或输出目标。流可以表示许多不同类型的源和目标,包括磁盘文件,设备,其他程序和内存阵列。
#1
1
The goal of InputStream and OutputStream is to abstract different ways to input and output: whether the stream is a file, a web page, or the screen shouldn't matter. All that matters is that you receive information from the stream (or send information into that stream.)
InputStream和OutputStream的目标是抽象输入和输出的不同方式:流是文件,网页还是屏幕无关紧要。重要的是您从流中接收信息(或将信息发送到该流中)。
InputStream is used for many things that you read from.
InputStream用于您读取的许多内容。
OutputStream is used for many things that you write to.
OutputStream用于您编写的许多内容。
#2
2
You can't get better explanation than this.
你无法得到比这更好的解释。
Summary:
InputStream: The abstract class; superclass of all classes representing an input stream of bytes.
InputStream:抽象类;表示输入字节流的所有类的超类。
OutputStream: This abstract class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.
OutputStream:此抽象类是表示输出字节流的所有类的超类。输出流接受输出字节并将它们发送到某个接收器。
Some more details are available here.
这里有更多细节。
To know about Character Streams, see here and here.
要了解Character Streams,请参阅此处和此处。
#3
-1
An I/O Stream represents an input source or an output destination. A stream can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays.
I / O流表示输入源或输出目标。流可以表示许多不同类型的源和目标,包括磁盘文件,设备,其他程序和内存阵列。