日期:2014-05-20 浏览次数:20724 次
public class CopyFiles {
public static void main(String[] args) throws IOException{
FileInputStream fis = new FileInputStream("D:"+File.separator+"test"+File.separator+"m01.gif");
FileOutputStream fos = new FileOutputStream("D:"+File.separator+"test"+File.separator+"m02.gif");
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);
byte[] b = new byte[1024*2];
int length = 0;
while((length = bis.read(b)) != -1){
bos.write(b, 0, length);
bos.flush();
}
bis.close();
bos.close();
}
}