Class FileUtils

java.lang.Object
org.drools.util.FileUtils

public class FileUtils extends Object
Utility to access files
  • Method Details

    • getFile

      public static File getFile(String fileName)
      Retrieve the File of the given file This method does not guarantee the returned file if multiple files, with same name, are present in different directories
      Parameters:
      fileName -
      Returns:
    • getFile

      public static File getFile(String fileName, String parentDir)
      Retrieve the File of the given file
      Parameters:
      fileName -
      parentDir -
      Returns:
    • getFileInputStream

      public static FileInputStream getFileInputStream(String fileName) throws IOException
      Retrieve the FileInputStream of the given file
      Parameters:
      fileName -
      Returns:
      Throws:
      IOException
    • getFileInputStream

      public static FileInputStream getFileInputStream(String fileName, String parentDir) throws IOException
      Retrieve the FileInputStream of the given file
      Parameters:
      fileName -
      parentDir -
      Returns:
      Throws:
      IOException
    • getFileContent

      public static String getFileContent(String fileName) throws IOException
      Retrieve the content of the given file
      Parameters:
      fileName -
      Returns:
      Throws:
      IOException
    • getFileContent

      public static String getFileContent(String fileName, String parentDir) throws IOException
      Retrieve the content of the given file
      Parameters:
      fileName -
      parentDir -
      Returns:
      Throws:
      IOException
    • getInputStreamFromFileNameAndClassLoader

      public static Optional<InputStream> getInputStreamFromFileNameAndClassLoader(String fileName, ClassLoader classLoader)
      Parameters:
      fileName -
      classLoader -
      Returns:
    • deleteDirectory

      public static void deleteDirectory(Path path)
      delete a directory and all its content
      Parameters:
      path - path to the directory to delete