Подскажите,пожалуйста, почему такой вариант не принимает. На деле все отлично работает. Компилятор просто хочет какой-то конкретной реализации этой задачи? Заранее благодарю.
Ошибка в файле com/javarush/task/task18/task1818/Solution.java в строке : 22
Не найден метод "readAllBytes()" в переменной "fileInputStream"
package com.javarush.task.task18.task1818;
/*
Два в одном
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String nameOfTheMainFile = reader.readLine(); //"File 1"
String nameOfTheFile = reader.readLine(); //"File 2"
//Stream to read bytes from the "File 2"
FileInputStream fileInputStream = new FileInputStream(nameOfTheFile);
//Stream to write bytes into the "File 1"
FileOutputStream fileOutputStream = new FileOutputStream(nameOfTheMainFile);
//Record all the bytes from the "File 2" into the "File 1"
while(fileInputStream.available() > 0){
fileOutputStream.write(fileInputStream.readAllBytes());
}
nameOfTheFile = reader.readLine();//"File 3"
//Stream to read bytes from the "File 3"
fileInputStream = new FileInputStream(nameOfTheFile);
//Record all the bytes from the "File 3" into the "File 1"
while(fileInputStream.available() > 0){
fileOutputStream.write(fileInputStream.readAllBytes());
}
//Close all streams
reader.close();
fileInputStream.close();
fileOutputStream.close();
}
}