1: Character Stream (mastering)
(1) Byte stream operation Chinese data is not particularly convenient, so there is a conversion stream.
The function of the conversion stream is to use the byte stream to convert the character stream.
(2) The conversion stream is actually a character stream
Character stream = byte stream + encoding table
(3) Coding table
A: A table consisting of characters and corresponding values
B: Common Coding tables
Ascii
Iso-8859-1
GB2312
GBK
GB18030
UTF-8
C: Encoding Issues in strings
Coding
String--byte[]
Decoding
Byte[]--String
(4) Coding problems in IO stream
A:outputstreamwriter
OutputStreamWriter (outputstream OS): Default encoding, GBK
OutputStreamWriter (OutputStream os,string charsetname): Specifies the encoding.
B:inputstreamreader
InputStreamReader (InputStream is): Default encoding, GBK
InputStreamReader (InputStream is,string charsetname): Specify encoding
C: The coding problem is actually very simple
As long as the code is consistent
(5) Character stream
Reader
|--inputstreamreader
|--filereader
|--bufferedreader
Writer
|--outputstreamwriter
|--filewriter
|--bufferedwriter
(6) Copy the text file (5 ways)
2:io Flow Summary (master)
IO stream
|--Byte stream
|--byte input stream
InputStream
int read (): reads one byte at a time
int read (byte[] bys): reads one byte array at a time
|--fileinputstream
|--bufferedinputstream
|--byte output stream
OutputStream
void write (int by): Write one byte at a time
void Write (byte[] bys,int index,int len): Write one part of a byte array at a time
|--fileoutputstream
|--bufferedoutputstream
|--character Stream
|--character input stream
Reader
int read (): read one character at a time
int read (char[] CHS): read one character array at a time
|--inputstreamreader
|--filereader
|--bufferedreader
String ReadLine (): reads one string at a time
|--character output stream
Writer
void write (int ch): Write one character at a time
void Write (char[] chs,int index,int len): Write one part of a character array at a time
|--outputstreamwriter
|--filewriter
|--bufferedwriter
void NewLine (): Write a line break
void write (string line): Write one string at a time
3: Case (Comprehension exercise once): code in another essay
A: Copy A text file 5 ways (Master)
B: Copy Picture (binary stream data) 4 ways (Master)
C: Store the data in the collection into a text file
D: Reading data from a text file into a set merge traversal collection
E: Copy a single-level folder
F: Copy the file specified in the single-level folder and modify the name
Review the bulk modification name
G: Copy Multilevel folders
H: Keyboard entry Student information stored in a text file from high to low score
I: Sort the strings in a file and output them to another text file
J: Using reader to simulate the unique functions of BufferedReader
K: Unique features of analog LineNumberReader
Re-stepping Learning Java on the road _day21 (character stream, io summary, case)