/**
* @param srcpic 复制前文件
* @param despic 复制后文件
*/
public static void copyPic(String srcpic, String despic) {
File file1 = new File(srcpic);
if (file1.length() == 0) {
return;
}
File file2 = new File(despic);
byte[] b = new byte[(int) file1.length()];
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(file1);
//没有指定文件则会创建
out = new FileOutputStream(file2);
//read()--int,-1表示读取完毕
while (in.read(b) != -1) {
out.write(b);
}
out.flush();
in.close();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}