Home > Java > JavaBase > what is stream in java

what is stream in java

(*-*)浩
Release: 2019-11-12 09:38:58
Original
5398 people have browsed it

The stream in Java is an abstract concept. When the program needs to read data from a certain data source, it will open a data stream. The data source can be a file, memory or network, etc.

what is stream in java

On the contrary, when you need to write data to a data source destination, a data stream will also be opened. , the data source destination can also be a file, memory or network, etc.

A stream is a set of sequential bytes with a starting point and an ending point. It is a general term or abstract for data transmission. That is, the transmission of data between two devices is called a stream. (Recommended study: java course)

The essence of a stream is data transmission. The stream is abstracted into various classes according to the data transmission characteristics to facilitate more intuitive data operations.

Streams in Java can be classified from different perspectives:

According to the direction of the stream: It is divided into input stream and output stream.

According to the different processing data units: is divided into byte stream (8 bits) and character stream (16 bits).

According to different functions: It is divided into node flow and processing flow.

Node stream: is a stream (such as file, memory) that can read and write data from a specific data source (node). It's like a single pipe is connected to a faucet and starts discharging water.

Processing stream: is "connected" to an existing stream (node ​​stream or processing stream), and provides the program with more powerful reading and writing functions by processing data. It is like connecting a pipe (node ​​flow) and adding several thicker pipes (processing flow) with special functions to further process the outflowing water.

The four basic streams InputStream, OutputStream, Reader, and Writer each have more specific subclasses, which are divided into file stream, buffer stream, data stream, conversion stream, Print stream, Object stream, etc., all of which are respectively Specific functions or used to operate specific data

The above is the detailed content of what is stream in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template