首页 > 文章列表 > java中PrintStream创建对象

java中PrintStream创建对象

java PrintStream
229 2022-08-06

1、将输出流out作为PrintStream的输出流,不会自动flush,采用默认字符集。

PrintStream out = new PrintStream(OutputStream out);

2、创建File对应的FileOutputstream,然后将FileOutputstream作为Printstream的输出流。

PrintStream out = new PrintStream(File file);

创建Filename对应的FileOutputStream,然后将FileoutputStream作为PrintStream的输出流。

PrintStream out = new PrintStream(String fileName, String charsetName);

推荐操作环境:windows7系统、java10版,DELL G3电脑。