Java—File character stream

File character stream


FileWriter: Equivalent to the combination of OutputStreamWriter and FileOutputStream, internally maintains a buffer, but requires manual flush Constructor: FileWriter(File file) FileWriter(File file, boolean append) FileWriter(String fileName) FileWriter(String fileName, boolean append) Append: indicates append, but this stream cannot set the character set. The commonly used method is similar to OutputStreamWriter FileReader: The function equivalent to InputStreamReader and FileInputStream also maintains a buffer internally. Constructor: FileReader(File file) FileReader(String fileName) Common methods are similar to InputStreamReader