private static boolean combine(String outFile, List inFiles) throws Exception{
File[] files = new File[inFiles.size()];
for(int i = 0; i < files.length; i++){
files[i] = new File(inFiles.get(i));
}
FileInputStream fis = null;
FileOutputStream fos = new FileOutputStream(outFile, true);//合并其实就是文件的续写,写成true
for (int i = 0; i < files.length; i++){
fis = new FileInputStream(files[i]);
int len = 0;
for (byte[] buf = new byte[1024 * 1024]; (len = fis.read(buf)) != -1;){
fos.write(buf, 0, len);
}
fis.close();
}
fos.close();
return true;
}