zoukankan
html css js c++ java
字符流Writer对象创建子类及其方法
字符流中输出数据主要用Writer来完成,输出使用Reader
父类---Writer
子类---BufferedWriter / CharArrayWriter / FilterWriter / OutputStreamWriter子类 (File Writer) / PipedWriter / PrintWriter / StringWriter
Writer是抽象类,不能直接创建对象,一般都是通过子类实例化创建对象;
在文件末尾追加内容时创建格式:
File f=new File("e:"+File.separator+"test.txt");
Writer out=new FileWriter(f,true); / new
BufferedWriter(f,true); / new CharArrayWriter(f,true); / new FilterWriter(f,true); / new OutputStreamWriter(f,true); / new PipedWriter(f,true); / new PrintWriter(f,true); / new StringWriter(f,true);
Writer常用方法归纳----实例中的调用格式:
out.close(); //关闭输出流
out.write(String s1); //将字符串输出
out.write(char[] a); //将字符数组输出
out.flush(); //强制性清除缓存
*****************************************注意:Writer类中的大多方法都会抛出IOException异常,可以使用cry catch块/在main()后面加 throws Exception 来处理这些异常。************************************
查看全文
相关阅读:
VS2005中的WebApplication和WebSite
CodeFile 与 CodeBehind 的区别
vs2005默认浏览器(IE)灵异事件
杭电OJ第4252题 A Famous City
湘大OJ第1490题 Generating Random Numbers
中南OJ 2012年8月月赛 B题 Barricade
中南OJ 2012年8月月赛 H题 Happy watering
杭电OJ第4245题 A Famous Music Composer
中南OJ 2012年8月月赛 I题 Imagination
杭电OJ第4256题 The Famous Clock
原文地址:https://www.cnblogs.com/l666/p/9128651.html
最新文章
JZ038二叉树的深度
centOS搭建本地yum
为什么说linux是开源不开放, android是开源又开放.
http操作
[unix c]关于FOLK和PRINTF()的一个小问题
The Java Data Mining API[转]
如意才一年......
理解
half 郁闷 reserved
圣经一段
热门文章
[复习计划]IMS5024
随便谈谈
"We are Australian"
一个开源的ETL工具
将Excel内容导入数据库(ASP.NET/C#)
VS2005灵异事件2“缺少引用”以及“断点无法命中”
将Dataset数据导出到Excel中(ASP.NET/C#)
关于vs2005的“EnableEventValidation”
ASP.NET打印
仿Excle公式
Copyright © 2011-2022 走看看