IO流学习
2016-04-25 19:44
344 查看
字节流:FileInputStream , FileOutputStream
public class IOdemo {
}
字符流:FileReader , FileWriter
字节流转字符流:InputStreamReader,OutputStreamWriter
缓冲流(字符串):BufferedReader , BufferedWriter
键盘输入流:System.in , 属于字节输入流
键盘输出流:System.out , 属于字节输出流
数据类型流:DataInputStream,DataOutputStream(字节流)
对象流:ObjectInputStream,ObjectOutputStream(字节流)
public class IOdemo {
public static void main(String[] args) throws IOException { File file = new File("F:\\hehe.txt"); FileInputStream in = new FileInputStream(file); File f = new File("2.txt"); byte[] str = new byte[100]; in.read(str);//读文件信息 String s = new String(str); System.out.println(s); in.close(); File file1 = new File("F:\\hello.txt"); FileOutputStream out = new FileOutputStream(file1); byte[] b = new byte[100]; String data = new String("hello wrold"); b = data.getBytes(); out.write(b);//写文件信息 out.close(); }
}
字符流:FileReader , FileWriter
字节流转字符流:InputStreamReader,OutputStreamWriter
缓冲流(字符串):BufferedReader , BufferedWriter
键盘输入流:System.in , 属于字节输入流
键盘输出流:System.out , 属于字节输出流
数据类型流:DataInputStream,DataOutputStream(字节流)
对象流:ObjectInputStream,ObjectOutputStream(字节流)
相关文章推荐
- Masonry介绍与使用实践(快速上手Autolayout)
- mips 的内存映射问题
- HDU 1166 敌兵布阵
- leetcode 345Reverse vowels of a string
- Impala与Hive的比较
- Java面试中的多线程问题
- 第一次冲刺阶段(八)
- react-redux单元测试(基于react-addons-test-utils,mocha)
- vs中正常IIS发布网站后css样式、图片丢失jQuery报错 $ is not defined
- 最短路模板(Dijkstra & Dijkstra算法+堆优化 & bellman_ford & 单源最短路SPFA)
- 拆点最大流-POJ-3436-ACM Computer Factory
- bnu 51638 Air Hockey(三分+二分)(北师16校赛)
- [动态树分治]
- 地图使用-----MapKit介绍
- Git远程和分支管理
- 大数据 > 数据平台方案评估
- 新闻发布系统——触发器和存储过程的区别
- listview
- spring-boot 初学一
- 5-1 Verilog Moore状态机之十字路口