it知识
java中怎么用PrintStream创建对象
2023-08-06 21:09  点击:0

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);