I don't understand why the the buffers don't overwrite the existing text.
If I write several buffers to the same outputfile. How does it know where to start?
FileOutputStream fos = new FileOutputStream(fileComposite);//if I do not set the "append" to true
//iterate over the map with filenames
for (String fileName : folder.values()) {
//create inputStream to read content of each file
FileInputStream fis = new FileInputStream(fileName);//gives a nullpointer exception as the files do not exist
//create a buffer for all bytes read available() gives number of bytes to read
byte[] buffer = new byte[fis.available()];
//read the bytes from a file and add it to the buffer
while (fis.available() > 0) {
//reads all the bytes and put them in the buffer?
int byteRead = fis.read(buffer);
//write the buffer to outputStream file
fos.write(buffer, 0, byteRead);//why doesn't oit verwrite the previous part?
}
fis.close();
}
fos.close();