При том что оно работает как надо???
package com.javarush.task.task18.task1825;
/*
Собираем файл
*/
import java.io.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
List<byte []> list = new LinkedList<>();
Scanner scanner = new Scanner(System.in);
while (true){
String s = scanner.nextLine();
if(s.equals("end")) break;;
int i = Integer.parseInt(s.substring(13, s.length()));
try(FileInputStream inputStream = new FileInputStream("D:\\Java\\" + s +".txt");
BufferedInputStream reader = new BufferedInputStream(inputStream);)
{
byte[] b = new byte[inputStream.available()];
while (inputStream.available() > 0){
reader.read(b);
}
list.add(i - 1, b);
}
catch (FileNotFoundException e){
e.printStackTrace();
}
catch (IOException e){
e.printStackTrace();
}
try(FileOutputStream outputStream = new FileOutputStream("D:\\Java\\Lion.avi.txt");
BufferedOutputStream writer = new BufferedOutputStream(outputStream);)
{
for (byte [] b : list){
writer.write(b);
}
}
catch (FileNotFoundException e){
e.printStackTrace();
}
catch (IOException e){
e.printStackTrace();
}
}
}
}