import java.io.*;
import java.util.*;
public class demo15
{
public static void main(String args[])
{
try{
FileInputStream fis = new FileInputStream("pw.txt");
FileOutputStream fos = new FileOutputStream("pwcopy.txt");
byte []buffer = new byte[1024];//缓冲区
int length = -1;
while((length=fis.read(buffer))!=-1)
{
fos.write(buffer,0,length);
}
System.out.println("over");
fis.close();
fos.close();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
用自定义缓存区的方式实现文件的移动
最新推荐文章于 2022-04-07 16:35:08 发布