Class FileUtil

java.lang.Object
de.pirckheimer_gymnasium.engine_pi.util.FileUtil

public final class FileUtil extends Object
  • Method Details

    • deleteDir

      public static boolean deleteDir(File dir)
    • findFilesByExtension

      public static List<String> findFilesByExtension(List<String> fileNames, Path dir, String extension)
    • findFiles

      public static List<String> findFiles(List<String> fileNames, Path dir, String... files)
    • getExtension

      public static String getExtension(File file)
    • getExtension

      public static String getExtension(String path)
    • getFileName

      public static String getFileName(URL path)
    • getFileName

      public static String getFileName(String path)
    • getFileName

      public static String getFileName(String path, boolean extension)
    • getParentDirPath

      public static String getParentDirPath(String uri)
    • getParentDirPath

      public static String getParentDirPath(URI uri)
    • combine

      public static String combine(String basePath, String... paths)
      This method combines the specified basepath with the parts provided as arguments. The output will use the path separator of the current system;
      Parameters:
      basePath - The base path for the combined path.
      paths - The parts of the path to be constructed.
      Returns:
      The combined path.
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes)
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes, boolean decimal)
    • normalizePath

      public static String normalizePath(String path)
      Ersetzt im gegebenen Dateipfad alle Schrägstriche (Slashes) und Gegenschrägstriche (Backslashes) mit dem Zeichen des Attributs File.separator.
      Parameters:
      path - Ein Dateipfad, der Schrägstriche oder Gegenschrägstriche enthalten kann.
      Returns:
      Der normalisierte Dateipfad.
    • exists

      public static boolean exists(String filePath)
    • getHome

      public static String getHome()
      https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/System.html#getProperties()
    • createDir

      public static void createDir(String dirpath)