PrintStream(File file, String csn) constructor from PrintStream has the following syntax.
public PrintStream(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException
In the following code shows how to use PrintStream.PrintStream(File file, String csn) constructor.
/*from w w w. j av a2 s .c om*/ import java.io.File; import java.io.PrintStream; public class Main { public static void main(String[] args) throws Exception { byte c = 70; PrintStream ps = new PrintStream(new File("c:/text.txt"),"ASCII"); // write byte c which is character F in ASCII ps.write(c); // flush the stream ps.flush(); ps.close(); } }