Class FileUtils

java.lang.Object
org.variantsync.diffdetective.util.FileUtils

public class FileUtils extends Object
Utility functions for handling file paths.
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • replaceLineEndings

      public static String replaceLineEndings(String text, String replacee)
      Replace the line endings of any operating system in text by replace
    • isEmptyDirectory

      public static boolean isEmptyDirectory(Path p) throws IOException
      Returns true iff p can be created or is an empty directory.
      Throws:
      IOException - if the file system signals an error
    • tryIsEmptyDirectory

      public static boolean tryIsEmptyDirectory(Path p)
      Returns true if p can be created or is an empty directory. If the file system signals an error, this function returns false.
    • listAllFilesRecursively

      public static List<Path> listAllFilesRecursively(Path directory) throws IOException
      Returns a list of all regular files inside/below directory.
      Throws:
      IOException - if the file system signals an error
    • hasExtension

      public static boolean hasExtension(Path p, String expected)
      Checks if p has the file extension expected. Note that the common dot delimiter has to be included in expected.
    • isLineGraph

      public static boolean isLineGraph(Path p)
      Check if the path p has a line graph extension.
    • addExtension

      public static Path addExtension(Path p, String extension)
      Adds extension to the filename of p. Note that the common dot delimiter has to be included in extension.