There show me that file Lion.txt.part1 dosnt exist but i realy dont know why.
Same i have no idea why Condition with buffer using is not accepted.
I need help!
package pl.codegym.task.task18.task1825;
import java.io.*;
import java.util.*;
/*
Tworzenie pliku
*/
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s="", outFile = "";
ArrayList<String> listaPlikow = new ArrayList<>();
HashMap<Integer, String> plikiNr = new HashMap<>();
while (true){
s = reader.readLine();
if (s.equals("end")) {
reader.close();
break;
}else{
listaPlikow.add(s);
}
}
reader.close();
for (String a : listaPlikow){
String nrA="";
String[] part = a.split(".part");
nrA=part[part.length-1];
outFile=part[0];
int nr = Integer.parseInt(nrA);
plikiNr.put(nr, a);
}
ArrayList<Integer> sortowanie = new ArrayList<>();
for (Map.Entry<Integer,String> para : plikiNr.entrySet()){
sortowanie.add(para.getKey());
}
Collections.sort(sortowanie);
BufferedOutputStream BOS = new BufferedOutputStream(new FileOutputStream(outFile));
for(Integer l : sortowanie){
for (Map.Entry<Integer, String> para : plikiNr.entrySet()){
if (para.getKey()==l){
BufferedInputStream BIS = new BufferedInputStream(new FileInputStream(para.getValue()));
byte[] czescDanych = new byte[BIS.available()];
for(byte p : czescDanych) BOS.write(p);
BIS.close();
}
}
}
BOS.close();
}
}