Why are the files not being copied and added to the new file?
package com.codegym.task.task18.task1825;
import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;
/*
Building a file
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream inputStream;
FileOutputStream outputStream;
String fileName = "";
String compiledFile = "";
Set<File> order = new TreeSet<>();
while (!(fileName = reader.readLine()).equals("end")) {
if (fileName.contains(".part")) {
compiledFile = fileName.split(".part")[0];
order.add(new File(fileName));
}
}
outputStream = new FileOutputStream(compiledFile);
for (File each : order) {
inputStream = new FileInputStream(each);
byte[] data = new byte[inputStream.available()];
inputStream.read(data);
outputStream.write(data);
inputStream.close();
}
outputStream.close();
}
static class CompareFiles implements Comparator<File> {
@Override
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
}
}