1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
public void fusion(String destFile,LinkedList<String> sourceFiles)
throws IOException {
File file = new File(destFile);
FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter out = new OutputStreamWriter(fos,"ISO-8859-1");
try {
char[] buf = new char[8192];
int read = 0;
for (String filename : sourceFiles) {
InputStream in = new FileInputStream(filename);
Reader r = new InputStreamReader(in,"ISO-8859-1");
try {
while ((read = r.read(buf)) != -1) {
out.write(buf, 0, read);
}
} finally {
in.close();
}
}
} finally {
out.close();
}
} |