package com.glut.util;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
//import java.io.File;
//import java.io.FileInputStream;
import java.io.IOException;
public class main{
public static void main(String[] args) {
try {
int len;
byte[] b= new byte[1024];
FileInputStream in=new FileInputStream("C:\\Users\\10693\\Desktop\\111.txt");//创建输入流对象
FileOutputStream ou=new FileOutputStream("C:\\Users\\10693\\Desktop\\222.txt");
BufferedInputStream isr=new BufferedInputStream(in);//创建缓冲管道
BufferedOutputStream ous=new BufferedOutputStream(ou);
while((len=isr.read(b))!= -1) {
ous.write(b);//写入输出流对象
ous.close();//关闭输出流
}
isr.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
实现了文件的复制
io流继续
最新推荐文章于 2024-01-06 18:44:24 发布