/* * ¹¦ÄÜ£ºÍ¼Æ¬´ÓÒ»¸öλÖöÁÈ룬д³öµ½ÁíÒ»¸öλÖà */ package com.bj.io; import java.io.*; public class CopyImage { public static void main(String[] args) { // TODO Auto-generated method stub File file=new File("D:/www/a.jpg");//a.jpg±ØÐëÒª´æÔÚ //×Ö½ÚÁ÷¶ÁÈ롢д³ö FileInputStream fis=null; FileOutputStream fos=null; try { fis=new FileInputStream(file); fos=new FileOutputStream("D:/www/b.jpg"); byte bytes[] =new byte[1024]; //¼ÆÊý¶ÁÈë×Ö½ÚÊý int count=0; while(-1!=(count=fis.read(bytes))){ //д³öµ½Ö¸¶¨Î»Öà fos.write(bytes); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { //¹Ø±ÕÎļþ×Ö½ÚÁ÷ fis.close(); fos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }