public class Test {
public static void copy(File source,File target){
InputStream in=null;
OutputStream out=null;
try {
in=new BufferedInputStream(new FileInputStream(source));
out=new BufferedOutputStream(new FileOutputStream(target));
byte[] buff=new byte[1024];
while(in.read(buff)>0){
out.write(buff);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
try {
if(in!=null)
in.close();
if(out!=null)
out.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}