DeliveryApi/cdk/src/main/java/com/ilmlf/delivery/api/Hashing.java [32:63]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class Hashing {
  public static String hashDirectory(String directoryPath, boolean includeHiddenFiles)
      throws IOException {
    File directory = new File(directoryPath);

    if (!directory.isDirectory()) {
      throw new IllegalArgumentException("Not a directory");
    }

    Vector<FileInputStream> fileStreams = new Vector<>();
    collectFiles(directory, fileStreams, includeHiddenFiles);

    try (SequenceInputStream sequenceInputStream =
        new SequenceInputStream(fileStreams.elements())) {
      return DigestUtils.md5Hex(sequenceInputStream);
    }
  }

  private static void collectFiles(
      File directory, List<FileInputStream> fileInputStreams, boolean includeHiddenFiles)
      throws IOException {
    File[] files = directory.listFiles();

    if (files != null) {
      Arrays.sort(files, Comparator.comparing(File::getName));

      for (File file : files) {
        if (includeHiddenFiles || !Files.isHidden(file.toPath())) {
          if (file.isDirectory()) {
            collectFiles(file, fileInputStreams, includeHiddenFiles);
          } else {
            fileInputStreams.add(new FileInputStream(file));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



WorkingFromHome/ClientConnection/src/main/java/com/ilmlf/clientconnection/Hashing.java [11:42]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public class Hashing {
  public static String hashDirectory(String directoryPath, boolean includeHiddenFiles)
      throws IOException {
    File directory = new File(directoryPath);

    if (!directory.isDirectory()) {
      throw new IllegalArgumentException("Not a directory");
    }

    Vector<FileInputStream> fileStreams = new Vector<>();
    collectFiles(directory, fileStreams, includeHiddenFiles);

    try (SequenceInputStream sequenceInputStream =
        new SequenceInputStream(fileStreams.elements())) {
      return DigestUtils.md5Hex(sequenceInputStream);
    }
  }

  private static void collectFiles(
      File directory, List<FileInputStream> fileInputStreams, boolean includeHiddenFiles)
      throws IOException {
    File[] files = directory.listFiles();

    if (files != null) {
      Arrays.sort(files, Comparator.comparing(File::getName));

      for (File file : files) {
        if (includeHiddenFiles || !Files.isHidden(file.toPath())) {
          if (file.isDirectory()) {
            collectFiles(file, fileInputStreams, includeHiddenFiles);
          } else {
            fileInputStreams.add(new FileInputStream(file));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



