Class PathTools

java.lang.Object
org.savantbuild.dep.PathTools

public class PathTools extends Object
File utilities.
  • Constructor Details

    • PathTools

      public PathTools()
  • Method Details

    • createTempPath

      public static Path createTempPath(String prefix, String suffix, boolean deleteOnExit) throws IOException
      Creates a temporary file.
      Parameters:
      prefix - The prefix for the temporary file.
      suffix - The suffix for the temporary file.
      deleteOnExit - If the file should be deleted when the JVM exits.
      Returns:
      The Path of the temporary file.
      Throws:
      IOException - If the create fails.
    • prune

      public static void prune(Path path) throws IOException
      Prunes the given path. If the path is a directory, this deletes everything underneath it, but does not traverse across symbolic links, it simply deletes the link. If the path is a file, it is deleted. If the path is a symbolic link, it is unlinked.
      Parameters:
      path - The path to delete.
      Throws:
      IOException - If the prune failed for any reason. This might indicate that the prune was only partially successful.