I get no output in the file at all. Any help please?
package com.codegym.task.task18.task1825;
import java.io.*;
import java.util.*;
/*
Building a file
C:\Users\40742\Desktop\Files\Lion.avi.part1.txt
1. The program must read file names from the console until the word "end" is entered.
2. Create a stream to write to the file without the "part" suffix (".<partN>") in the folder with all the "part" files.
3. Copy all the bytes from the *.partN files to the new file.
4. You should use a buffer for the reading and writing.
5. The file streams must be closed.
6. Don't use static variables.
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
ArrayList<String > list = new ArrayList<>();
String fileOutPut = null;
FileInputStream fileInputStream = null;
FileOutputStream fileOutputStream = null;
while(!fileName.equals("end")){
list.add(fileName);
fileName = reader.readLine();
}
for(String x : list){
if(!x.contains("part")){
fileOutPut = x;
}
}
String address = "";
for(int i = 1; i < list.size();i++) {
for (int j = 0; j < list.size(); j++) {
if (list.get(j).contains("part" + i)) {
address = list.get(j);
}
}
fileInputStream = new FileInputStream(address);
System.out.println(address);
assert fileOutPut != null;
fileOutputStream = new FileOutputStream(fileOutPut);
while(fileInputStream.available() > 0){
int read = fileInputStream.read();
fileOutputStream.write(read);
}
fileInputStream.close();
fileOutputStream.close();
}
}
}