//将多个文件合并成一个文件 public static void merge(String newPath,String[] files) throws IOException { Vector<FileInputStream> v = new Vector<>(); for (String file:files) { v.add(new FileInputStream(file)); } Enumeration<FileInputStream> elements = v.elements(); SequenceInputStream sis = new SequenceInputStream(elements); FileOutputStream fos = new FileOutputStream(newPath); byte[] bytes = new byte[1024]; int len=0; while((len = sis.read(bytes))!=-1){ fos.write(bytes,0,len); } fos.close(); sis.close(); }