Java中实现文件拷实例
import java.io.*;
class copy_file
{
public static void copyfile(String path1,String path2) throws IOException //使用FileInputStream和FileOutStream
{
FileInputStream fi=new FileInputStream(path1);
FileOutputStream fo=new FileOutputStream(path2);
byte data[]=new byte[fi.available()];
fi.read(data);
fo.write(data);
fi.close();
fo.close();
}
}
public class joss
{
public static void main(String args[]) throws IOException
{
copy_file.copyfile("f:\\1.jpg?http://www.xvna.com","f:\\2.jpg?http://www.xvna.com");
}
}