Java PrintStream(String fileName, String csn) Constructor
Syntax
PrintStream(String fileName, String csn) constructor from PrintStream has the following syntax.
public PrintStream(String fileName, String csn) throws FileNotFoundException , UnsupportedEncodingException
Example
In the following code shows how to use PrintStream.PrintStream(String fileName, String csn) constructor.
/*from ww w .j av a 2 s . co m*/
import java.io.PrintStream;
public class Main {
public static void main(String[] args) throws Exception {
byte c = 70;
PrintStream ps = new PrintStream("c:/text.txt","UTF8");
// write byte c which is character F in ASCII
ps.write(c);
// flush the stream
ps.flush();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »