首页  >  文章  >  Java  >  如何使用Java创建PrintStream对象?

如何使用Java创建PrintStream对象?

WBOY
WBOY转载
2023-04-26 21:40:241380浏览

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

以上是如何使用Java创建PrintStream对象?的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:yisu.com。如有侵权,请联系admin@php.cn删除