Byte stream refers to a stream in which the most basic unit of transmitted data is a byte during the transmission process, a continuous stream that does not contain boundary data; a byte stream is composed of bytes and is mainly used for processing Binary data.
Stream
is an abstract concept, an abstraction of input and output devices.Input stream
can be regarded as a Input channel, output stream can be regarded as an output channel. The input stream is relative to the program. Incoming data from the outside to the program requires the use of the input stream. The output stream is relative to the program. The program needs to use the output stream to transmit data to the outside.
What is a byte stream?
During the transmission process, the most basic unit of transmitted data is the stream of bytes
What is a character stream?
Character stream--During the transmission process, the most basic unit of transmitted data is the stream of characters.
Character encoding methods are different, and sometimes the number of bytes used by a character is also different. For example, a character encoded in ASCLL mode occupies one byte; while a character encoded in UTF-8 mode occupies one English byte. A character requires one byte, and a Chinese character requires three bytes.
Byte data is in binary form. To convert it into normal characters that we can recognize, we need to choose the correct encoding method. The garbled problem we encounter in our lives is that the byte data does not choose the correct encoding method to display as characters.
Essentially speaking, when writing data (that is, output), whether it is bytes or characters, there is essentially no identifier, and the encoding method needs to be specified.
But when reading data, if we need to "see the data", then the byte stream data needs to specify the character encoding method so that we can see the characters we can recognize; and the character stream, because it has Once the character encoding method is selected, there is usually no need to change it (unless the defined character encoding method is inconsistent with the original encoding method of the data!)
In terms of transmission, since the essence of computer transmission is bytes , and a character is composed of multiple bytes. Before converting it into bytes, it must first look up the table and convert it into bytes, so buffers are sometimes used during transmission.
The byte stream is composed of bytes, and the character stream is composed of characters. In Java, characters are composed of two bytes.
Byte stream is the most basic, all subclasses of InputStream and OutputStream are, mainly used to process binary data, it is processed by bytes, but in practice a lot of data is text.
A stream is a stream. A continuous queue of bytes.
A stream is a continuous sequence of bytes input or output by a program. The input and output of devices (such as mouse, keyboard, disk, screen and printer) are processed using streams. In C language, all streams appear in the form of files, not necessarily physical disk files, but also logical files corresponding to a certain input/output source. Streaming mainly refers to the entire audio Multimedia files such as videos and three-dimensional media are parsed into compressed packages through specific compression methods, and are transmitted sequentially or in real time by the video server to the user's computer.
The above is the detailed content of What is a byte stream?. For more information, please follow other related articles on the PHP Chinese website!