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