字节流 自定义缓冲字节数组 读写文件
2016-04-10 22:18
375 查看
package com.heima.lei; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Test1 { /**字节流 自定义缓冲字节数组 读写文件 * @param args * @throws IOException */ public static void main(String[] args) throws IOException { FileInputStream fis = new FileInputStream("001.txt"); FileOutputStream fos = new FileOutputStream("002.txt"); int len; byte [] arr = new byte[5]; while((len = fis.read(arr)) != -1){ fos.write(arr,0,len); } fis.close(); fos.close(); } }
相关文章推荐
- 四个窗口卖票
- implements Runnable synchronized代码块 * 2个线程向同一数组中加随机数,每个数组加3个数,交替
- css3之文本,字体,颜色
- Java并发编程:线程间协作的两种方式:wait、notify、notifyAll和Condition
- 响应式布局
- 20145213《Java程序设计》实验报告一:Java开发环境的熟悉(Windows+IDEA)
- VMware网络设置
- datagridView 去重
- CoreAnimation
- 了解typename的双重意义
- 人物头顶名称与血条更新与绘制
- Selenium启动不同浏览器
- 2个线程向同一数组中加随机数,每个数组加3个数,交替
- 自定义类MyThread 实现Runnable接口,主函数创建5个线程,自定义线程类的构造函数输出 创建线程X -002
- 设计模式之访问者模式
- px,em,rem的区别
- Educational Codeforces Round 10
- stringstream的用法
- 第八届郑州轻工业学院ACM程序设计大赛校内预选赛
- 20160410感言