Here you can find the source of getPrintWriter(String fileName, Writer out)
public static PrintWriter getPrintWriter(String fileName, Writer out) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static PrintWriter getPrintWriter(String fileName, Writer out) throws IOException { if (fileName == null) return null; Writer writer = fileName.equals("-") ? out : new BufferedWriter(new FileWriter(fileName)); return new PrintWriter(writer); }//from w w w. j a v a2 s .c om }