Помогите. Не пойму где ошибка. + Напшиите замечания по коду пожалуйста
package com.javarush.task.task18.task1819;
/*
Объединение файлов
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
File file1 = new File(reader.readLine());
File file2 = new File(reader.readLine());
FileInputStream fIS = new FileInputStream(file1);
int dataSize = fIS.available();
byte [] buffer = new byte[dataSize];
while (fIS.available()>0){
fIS.read(buffer, 0, dataSize);
}
fIS.close();
FileOutputStream fOS = new FileOutputStream(file1, true);
FileInputStream fIS2 = new FileInputStream(file2);
while (fIS2.available() > 0) fOS.write(fIS2.read());
fOS.write(buffer);
fOS.close();
fIS2.close();
}
}