class FileUtils {

  public static Map<String, byte[]> getFilesGroupByFilename(String pathName) throws IOException {

    if (pathName == null) {
      throw new IOException("Path is null");
    }

    if (!new File(pathName).exists()) {
      throw new IOException("Path " + pathName + " is not exists");
    }

    Map<String, byte[]> filesGroup = new HashMap<>();
    File path = new File(pathName);

    Files.walkFileTree(Paths.get(path.toURI()), new SimpleFileVisitor<Path>() {
      @Override
      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
        filesGroup.put(file.toFile().getName(), Files.readAllBytes(file));
        return super.visitFile(file, attrs);
      }
    });

    return filesGroup;
  }

}