D
Dustin
Greetings
I am trying to append a few files using FileOutputStream (Java 1.4) and
it does not seem to be working correctly. My code is similar to as
follows:
File file1 = new File("some file path");
byte[] byteArray1 = getByteArray(file1);
File file2 = new File("some other file path");
byte[] byteArray2 = getByteArray(file2);
FileOutputStream os = new FileOutputStream("output path", true);
os.write(byteArray1);
os.flush();
os.write(byteArray2);
os.flush();
os.close();
I then go and try to open this file but it only has the content of
file2 (the second file written). It appears that it is not appending
but just writing.
Is there something which I am doing wrong here?
Thanks for your time and help.
I am trying to append a few files using FileOutputStream (Java 1.4) and
it does not seem to be working correctly. My code is similar to as
follows:
File file1 = new File("some file path");
byte[] byteArray1 = getByteArray(file1);
File file2 = new File("some other file path");
byte[] byteArray2 = getByteArray(file2);
FileOutputStream os = new FileOutputStream("output path", true);
os.write(byteArray1);
os.flush();
os.write(byteArray2);
os.flush();
os.close();
I then go and try to open this file but it only has the content of
file2 (the second file written). It appears that it is not appending
but just writing.
Is there something which I am doing wrong here?
Thanks for your time and help.