Java Fundamentals Hardening IO Stream Note 31: Causes and formats for the conversion stream to occur

Source: Internet
Author: User

1. Because the byte stream operation Chinese is not particularly convenient , so Java provides the conversion stream .

Character stream = byte stream + encoding table

2. Coding table

A table consisting of characters and their corresponding values

Common Coding tables:

Ascii/unicode Character Set

Iso-8859-1

gb2312/gbk/gb18030

BIG5

UTF-8

3. Encoding and decoding problems in the String class:

(1) Using construction method in string: ( decoding )

String(byte[] bytes, String charsetName)
Constructs a new one by using the specified charset to decode the specified byte array String .

(2) Function method used in string: ( coded )

byte[] getBytes(String charsetName)
Encodes this into a byte sequence using the specified character set String and stores the result in a new byte array.

Java Fundamentals Hardening IO Stream Note 31: Causes and formats for the conversion stream to occur

Related Article

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.