Byte Stream and character stream

Source: Internet
Author: User

First, there is the concept of input stream and output stream in Java io, what does the flow mean? In Java, the flow is often expressed as a continuous, like the concept of water flow, but here is the flow of data.

There are two types of Java streaming, the byte stream and the character stream, which are, in essence, still based on bytes.

Byte stream: Indicates that the input/output data is bytes, which is consistent with the theory in many of our computer courses that data is stored in bytes in a computer, and that this type of information is exchanged directly between bytes and computers when communicating with a computer.

Character stream: This type of data is input and output in character units, but its underlying is in bytes, such as the previous ASCII code table, which is actually the United States for the national computer, it is a 8-bit binary number of a character, In this way, it is almost possible to represent all the characters that are often used in binary code, and later, because each country compiles its own code table, but each country's character is different, and sometimes even the same character, its corresponding binary number is not the same, For example, China's GBK and the United States of ASCII is completely different, so that the United States over the data, to China but with GBK code parsing, will appear garbled, in order to solve this problem, international standards Organization (should often hear it) on the development of a world-wide unified Code table, Unicode code table, Because there are many characters in the world, so it is impossible to use 8-bit binary to be able to express, so the internationalization standard organization uses two byte (16) bit to represent each character, note, is each character, even if previously in ASCII can be expressed in a byte, here is also used in two bytes to represent, so, In order to manipulate the characters conveniently, Java uses the character stream method, the data passes over the byte to find its corresponding code table, then converts to the character output.

(If there is an error, please correct me, learn together, greatly appreciated)!

Byte Stream and character stream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.