介绍
- java.io.FileWriter
public class FileWriter extends OutputStreamWriter
- 用于写出文件字符流
- 可以指定编码
API
构造器
FileWriter(String fileName) throws IOException
FileWriter(String fileName, boolean append) throws IOException
FileWriter(File file) throws IOException
FileWriter(File file, boolean append) throws IOException
FileWriter(FileDescriptor fd)
FileWriter(String fileName, Charset charset) throws IOException
FileWriter(String fileName, Charset charset, boolean append) throws IOException
FileWriter(File file, Charset charset) throws IOException
FileWriter(File file, Charset charset, boolean append) throws IOException
append
: 是否追加模式,默认写入模式(false)- 追加模式:将内容追加到文件原内容中
- 写入模式:覆盖文件原内容