Differences between byte stream and byte stream

Source: Internet
Author: User

To output one piece of binary data to a device one by one, or read one piece of binary data from a device one by one, no matter what the input/output device is, we must use a unified approach.

To complete these operations, describe them in an abstract way. This abstract description method is called the IO stream, and the corresponding abstract classes are outputstream and inputstream. Different implementation classes are replaced

Different Input and Output devices in the table are operated on bytes.

In applications, it is often necessary to output or read a piece of text with full characters. Can I use Word throttling? Everything in the computer eventually exists in a binary byte format. For the words "China"

First, get the corresponding byte, and then write the byte to the output stream. When reading, the first thing we read is the byte. But to display it as a character, we need to convert the byte into a character. By

In such a wide range of needs, people specifically provide the packaging class of the stream.

The underlying device always only accepts byte data. Sometimes, to write a string to the underlying device, you need to convert the string into bytes before writing it. The hidden stream is the packaging of byte streams, while the hidden stream is directly accepted.

String, which internally converts the string into bytes and then writes it to the underlying device, which provides a little convenience for writing or reading strings to Io settings.

When converting a character to a byte, pay attention to the encoding problem. Because the conversion of a string into a byte array is actually a certain encoding byte form of the character, reading is also the opposite principle.

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.