public void transfer(File source, File target){
FileInputStream in = null;
FileOutputStream out = null;
if(!source.exists()||!source.isFile()){
throw new IllegalArgumentException("file not exist");
}
if(target.exists()){
target.delete();
}
try{
target.createNewFile();
in = new FileInputStream(source);
out = new FileOutputStream(target);
FileChannel inChannel = in.getChannel();
WritebleByChannel outChannel = out.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
inChannel.close();
outChannel.close();
in.close();
out.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
}