java FileWriter and FileReader
2016-04-19 15:20
447 查看
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class FWFRDemo { final static String MSG = "Test message"; public static void main(String[] args) throws IOException { try (FileWriter fw = new FileWriter("temp")) { fw.write(MSG, 0, MSG.length()); } char[] buf = new char[MSG.length()]; try (FileReader fr = new FileReader("temp")) { fr.read(buf, 0, MSG.length()); System.out.println(buf); } } }
相关文章推荐
- Spring+Quartz实现定时任务的配置方法
- JAVA实现K-means聚类
- Spring @Conditional注解的使用
- Java的线程模型
- Java-单机版的书店管理系统(练习设计模块和思想_系列 七 )
- Java-单机版的书店管理系统(练习设计模块和思想_系列 七 )
- 深入理解java的抽象类和接口
- java Spring 在WEB应用中的实例化
- 用plupload+springMVC实现文件的上传
- Java对英文句子进行倒序排序
- SpringMVC中使用Interceptor拦截器
- 【Leetcode】:122. Best Time to Buy and Sell Stock II 问题 in JAVA
- JDK动态代理模式
- Java Double相加出现的怪事
- java泛型——基本使用
- spring AOP执行2次
- spring事务管理几种方式
- Spring多数据源分布式事务管理/springmvc+spring+atomikos[jta]+druid+mybatis
- 集合
- java知识点2016.4.14