Class IOTools

java.lang.Object
rife.bld.extension.tools.IOTools

public final class IOTools extends Object
I/O Tools.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Determines if the specified file exists, is a file, and is executable.
    static boolean
    Determines if the file at the specified path string exists, is a regular file, and is executable.
    static boolean
    Determines if the specified path exists, is a regular file, and is executable.
    static boolean
    exists(File file)
    Checks if the specified file exists.
    static boolean
    exists(String path)
    Checks whether a file or directory exists at the specified path.
    static boolean
    exists(Path path)
    Checks if the specified path exists.
    static boolean
    Determines if the specified File is a directory.
    static boolean
    Determines if the specified path string represents an existing directory.
    static boolean
    Determines if the specified Path represents an existing directory.
    static boolean
    mkdirs(File file)
    Creates the directory named by the specified File, including any necessary but nonexistent parent directories.
    static boolean
    mkdirs(String path)
    Creates the directory specified by the given path string, including any nonexistent parent directories as necessary.
    static boolean
    mkdirs(Path path)
    Creates the directory specified by the given Path, including any nonexistent parent directories as necessary.
    static boolean
    Checks if the specified file does not exist.
    static boolean
    Checks whether a file or directory does not exist at the specified path.
    static boolean
    Checks if the specified path does not exist.
    static File
    resolveFile(File base, String... segments)
    Resolves a file path by joining a base file with additional path segments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • canExecute

      public static boolean canExecute(File file)
      Determines if the specified file exists, is a file, and is executable.
      Parameters:
      file - The file to be checked
      Returns:
      true if the file exists, is a file, and can be executed; false otherwise
      Since:
      1.0
    • canExecute

      public static boolean canExecute(Path path)
      Determines if the specified path exists, is a regular file, and is executable.
      Parameters:
      path - The path to be checked
      Returns:
      true if the path exists, is a regular file, and can be executed; false otherwise
      Since:
      1.0
    • canExecute

      public static boolean canExecute(String path)
      Determines if the file at the specified path string exists, is a regular file, and is executable.
      Parameters:
      path - The path string to be checked
      Returns:
      true if the path exists, is a regular file, and can be executed; false otherwise
      Since:
      1.0
    • exists

      public static boolean exists(File file)
      Checks if the specified file exists.
      Parameters:
      file - The file to check for existence
      Returns:
      true if the file is not null and exists; false otherwise
      Since:
      1.0
    • exists

      public static boolean exists(Path path)
      Checks if the specified path exists.
      Parameters:
      path - The path to check for existence
      Returns:
      true if the path is not null and exists; false otherwise
      Since:
      1.0
    • exists

      public static boolean exists(String path)
      Checks whether a file or directory exists at the specified path.
      Parameters:
      path - The file system path to check for existence.
      Returns:
      true if the path is not null and a file or directory exists at the specified path; false otherwise
      Since:
      1.0
    • isDirectory

      public static boolean isDirectory(File file)
      Determines if the specified File is a directory.
      Parameters:
      file - The File object to be checked. If null, this method will return false
      Returns:
      true if the file exists and is a directory; false otherwise
      Since:
      1.0
    • isDirectory

      public static boolean isDirectory(Path path)
      Determines if the specified Path represents an existing directory.
      Parameters:
      path - The Path object to be checked. If null, this method returns false
      Returns:
      true if the path exists and is a directory; false otherwise
      Since:
      1.0
    • isDirectory

      public static boolean isDirectory(String path)
      Determines if the specified path string represents an existing directory.
      Parameters:
      path - The path string to be checked. If null or empty, this method will return false
      Returns:
      true if the specified path exists and is a directory; false otherwise (including when the path string is invalid)
      Since:
      1.0
    • mkdirs

      public static boolean mkdirs(File file)
      Creates the directory named by the specified File, including any necessary but nonexistent parent directories.
      Parameters:
      file - The File object representing the directory to be created. If null, this method returns false
      Returns:
      true if the directory was created successfully, or if it already exists; false if the directory could not be created or if the provided file is null
    • mkdirs

      public static boolean mkdirs(Path path)
      Creates the directory specified by the given Path, including any nonexistent parent directories as necessary.
      Parameters:
      path - The Path object representing the directory to be created. If null, this method will return false
      Returns:
      true if the directory was created successfully or already exists; false if the directory could not be created, or if the provided path is null
    • mkdirs

      public static boolean mkdirs(String path)
      Creates the directory specified by the given path string, including any nonexistent parent directories as necessary.
      Parameters:
      path - The path string representing the directory to be created. If null or blank, this method will return false
      Returns:
      true if the directory was created successfully or already exists; false if the directory could not be created, or if the provided path is null or blank
    • notExists

      public static boolean notExists(String path)
      Checks whether a file or directory does not exist at the specified path.
      Parameters:
      path - The file system path to check for non-existence.
      Returns:
      true if the path is null or no file or directory exists at the specified path; false otherwise
      Since:
      1.0
    • notExists

      public static boolean notExists(File file)
      Checks if the specified file does not exist.
      Parameters:
      file - The file to check for non-existence
      Returns:
      true if the file is null or does not exist; false otherwise
      Since:
      1.0
    • notExists

      public static boolean notExists(Path path)
      Checks if the specified path does not exist.
      Parameters:
      path - The path to check for non-existence
      Returns:
      true if the path is null or does not exist; false otherwise
      Since:
      1.0
    • resolveFile

      public static File resolveFile(File base, String... segments)
      Resolves a file path by joining a base file with additional path segments.

      This method constructs a file path by appending one or more path segments to a base file, using the platform-specific file separator. The resulting File object represents the complete path but does not create an actual file on the filesystem.

      Parameters:
      base - the base file path to start from
      segments - additional path segments to append, in order.
      Throws:
      NullPointerException - if base is null or if segments is null
      Since:
      1.0