2019-05-30 Java learning diaries IO (character stream) & character stream & other content recursively

IO (character stream)

 Character stream FileReader:

1. What character streams are?

Character stream can be directly read and write IO streams characters

Character stream reads characters, it is necessary to read the data byte, and then converted to characters. If you want to write a character, you need to re-byte character to write

2、FileReader

read FileReader class () method reads a character size according to the

Character stream FileWriter:

writer FileWriter class () method can be automatically converted character bytes to write it

Character stream copy:

Under what circumstances the use of character streams:

Character stream can also copy the text file, but not recommended. Because the characters will Byte to read, write there when the characters back to bytes.

The program needs to read a text, or need to write a piece of text can be used when a character stream

When reading is to read the size of the characters in accordance with, will not be half Chinese

When writing directly write a string, not converted into a byte array

 

Guess you like

Origin www.cnblogs.com/clqbolg/p/10953060.html