public PrintWriter (File file, Charset charset) throws IOException

Creates a new PrintWriter, without automatic line flushing, with the specified file and charset. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will encode characters using the provided charset.

Parameters:
file     The file to use as the destination of this writer. If the file exists then it will be truncated to zero size; otherwise, a new file will be created. The output will be written to the file and is buffered.
charset     A charset

Exceptions:
IOException     if an I/O error occurs while opening or creating the file
SecurityException     If a security manager is present and checkWrite(file.getPath()) denies write access to the file

Since:  10