您的位置:首页 > 其它

字节流 自定义缓冲字节数组 读写文件

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

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: