javaIO- character stream

2, Jifuryu

 

Jifuryu

Why is there a character stream?
After a coded character may occupy different number of bytes, and byte characters are not one to one relationship between the characters encoded could become unequal number of bytes
using a byte stream at the time of the operation of the text file is not very convenient, in the end can not accurately control the number of bytes for each character?
So Java provides a stream of characters designed to operate on the characters (character stream so only for text files)
can accurately get / put characters from the stream

Character set (encoding scheme) charSet

ASCII: American Standards Committee, represented by a 7-byte character 
ISO8859 -1 : Europe, Latin encoding with 8 byte represents a character 
GBK: Chinese encoding, represents a Chinese character two bytes 
GB2312: GBK upgraded version with more characters 
GB18030: GBK version replaced, but not very widely used 
BIG -5 : Traditional encoding 

Unicode: international standard code, the vast majority of the characters use two bytes of code, called Unicode encoding is 

UTF -8 : a Unicode encoding scheme to achieve, when the character appearing in the program need to write to a file on the hard disk, or transmitted over the network, specify a coding scheme, and the program thus compiled specific character word section 
features: a variable length encoding scheme, the encoded character could occupy 1 - 4 bytes: 
English one byte, Chinese generally occupies three bytes

Commutations

 

Guess you like

Origin www.cnblogs.com/wqbin/p/11240786.html