Data streams are divided into two categories: 1. Input stream [InputStream], the input stream can only be read but not written, while the output stream can only be written but not read. 2. Output stream [OutputStream], usually the input stream is used in the program to read data, and the output stream is used to write data, just like the data flows into and out of the program.
#A data stream is an ordered sequence of bytes with a starting point and an ending point. Including input stream and output stream.
Data stream is originally a concept used in the field of communications and represents a sequence of digitally encoded signals used in transmission of information. This concept was first proposed by Henzinger in 1998 in Document 87. He defined a data stream as "a sequence of data that can only be read once in a predetermined order."
The development of data flow applications is the result of the following two factors:
Detailed data
It has been able to continuously and automatically generate large amounts of detailed data. This type of data first appeared in the traditional banking and stock trading fields, and later also appeared in geological surveying, meteorology, astronomical observation, etc. In particular, the emergence of the Internet (network traffic monitoring, clickstream) and wireless communication networks (call records) has generated a large amount of data stream type data. We noticed that most of this type of data is related to geographical information. This is mainly because geographical information has a large dimension and is easy to generate such large amounts of detailed data.
Complex Analysis
Requires complex analysis of update streams in near real-time. Complex analysis of data in the above fields (such as trend analysis, prediction) was often performed offline (in data warehouses). However, some new applications (especially in the fields of network security and national security) are very time-sensitive. , such as detecting extreme events, fraud, intrusion, anomalies on the Internet, complex crowd monitoring, track trend, exploratory analyses, harmonic analysis, etc., all require online analysis.
After that, the academic community basically recognized this definition, and some articles slightly modified the definition on this basis. For example, S. Guha et al. [88] believe that a data stream is "an ordered sequence of points that can only be read once or a few times", where the "one pass" restriction in the aforementioned definition is relaxed.
Why do we emphasize the limit on the number of data reads in the processing of data streams? S. Muthukrishnan [89] pointed out that data flow refers to “input data arriving at a very high speed”, so the transmission, calculation and storage of data flow data will become difficult. In this case, there is only one opportunity to process the data when it first arrives, and it is difficult to access the data at other times (because there is no and no way to save the data).
Classification:
The nature and format of the data are different, and the processing methods of the convection are also different. Therefore, in the Java input/output class library, There are different stream classes corresponding to input/output streams of different natures. In java. In the io package, the basic input/output stream classes can be divided into two types according to the types of data they read and write: byte streams and character streams.
Input stream and output stream
Data streams are divided into two categories: input stream (InputStream) and output stream (OutputStream). The input stream can only be read but not written, while the output stream can only be written but not read. Typically programs use input streams to read data and output streams to write data, just as data flows into and out of the program. Data flow is used to make the input and output operations of the program independent of related devices.
The input stream can obtain data from the keyboard or a file, and the output stream can transmit data to the monitor, printer, or file.
Buffered Stream
In order to improve data transmission efficiency, a buffered stream (Buffered Stream) is usually used, that is, a stream is equipped with a buffer (buffer), and a buffer is dedicated to Memory block to transfer data to. When writing data to a buffered stream, the system does not send directly to the external device, but instead sends the data to a buffer. The buffer automatically records data. When the buffer is full, the system sends all data to the corresponding device.
When reading data from a buffered stream, the system actually reads the data from the buffer. When the buffer is empty, the system automatically reads data from the relevant device and reads as much data as possible to fill the buffer.
The above is the detailed content of Data flows are divided into several categories. For more information, please follow other related articles on the PHP Chinese website!