I am reading in multiple files and putting them all in to one new file. However for some reason when generating the new file there are EOF characters being inserted into the file.
This appears at the end of each line where the file ended.
|ýÿ
note I'm using UTF-16LE as it seems to be the only encoding that can properly handle prime quotations.
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile),"UTF-16LE"));
for (File f : files) {
System.out.println("merging: " + f.getName());
FileInputStream fis;
try {
Reader reader = new InputStreamReader (new FileInputStream(f), "UTF-16LE");
BufferedReader in = new BufferedReader(reader);
String aLine;
while ((aLine = in.readLine()) != null) {
out.write(aLine);
out.newLine();
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}