Home > Java > JavaBase > body text

The difference between java character stream and byte stream

Release: 2019-12-26 14:40:59
Original
5449 people have browsed it

The difference between java character stream and byte stream

Character stream: It is a data stream formed by adding encoding on the basis of byte stream

The meaning of character stream: because the byte stream is operating When using characters, there may be garbled characters caused by Chinese, so the character stream is derived from the byte stream.

All data in the program is transmitted or saved in the form of streams. The byte stream mainly operates type type data, and the type array shall prevail.

The difference between byte stream and character stream in java:

1. When reading and writing, one is reading and writing by bytes, and the other is by characters.

2. When reading and writing files, the content needs to be processed line by line. For example, when comparing specific characters, character streams are generally selected when processing a certain line of data. It only reads and writes files, and has nothing to do with the file content. Generally, byte stream is selected.

3. The ones ending with stream are both byte streams, and the ones ending with reader and writer are both character streams.

4. InputStream is the parent class of all byte input streams, and OutputStream is the parent class of all byte output streams.

5. Reader is the parent class of character input stream, and Writer is the parent class of character output stream.

For more java knowledge, please pay attention to the java basic tutorial column.

The above is the detailed content of The difference between java character stream and byte stream. 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