Как и у всех на этой задаче, меня валидатор не пропускает по тем же пунктам, судя по всему он ругается на эти три пункта при любой проблеме, поэтому я так и не смог найти где проблема конкретно у меня. Буду благодарен если кто-то заметит ошибку
package com.javarush.task.task31.task3101;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/*
Проход по дереву файлов
*/
public class Solution {
public static void main(String[] args) throws IOException {
File path = new File(args[0]);
File resultFileAbsolutePath = new File(args[1]);
File newPath = new File(resultFileAbsolutePath.getParent() + "/allFilesContent.txt");
FileUtils.renameFile(resultFileAbsolutePath, newPath);
TreeMap<String,String> map = new TreeMap<>();
readFiles(path, map);
FileOutputStream writer = new FileOutputStream(resultFileAbsolutePath, true);
for(Map.Entry<String,String> entry : map.entrySet()){
writer.write(entry.getValue().getBytes());
writer.write("\n".getBytes());
}
writer.close();
}
private static void readFiles(File path, TreeMap<String, String> map) throws IOException {
for(File file : path.listFiles()){
if(file.isDirectory()) readFiles(path, map);
else {
if(file.length()<=50){
FileInputStream inputStream = new FileInputStream(file.getAbsolutePath());
byte[] buffer = new byte[inputStream.available()];
inputStream.read(buffer);
map.put(file.getName(), new String(buffer, "UTF-8"));
inputStream.close();
}
}
}
}
}