Package org.drools.util
Class FileUtils
java.lang.Object
org.drools.util.FileUtils
Utility to access files
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteDirectory(Path path) delete a directory and all its contentstatic FileRetrieve theFileof the given file This method does not guarantee the returned file if multiple files, with same name, are present in different directoriesstatic FileRetrieve theFileof the given filestatic StringgetFileContent(String fileName) Retrieve the content of the given filestatic StringgetFileContent(String fileName, String parentDir) Retrieve the content of the given filestatic FileInputStreamgetFileInputStream(String fileName) Retrieve theFileInputStreamof the given filestatic FileInputStreamgetFileInputStream(String fileName, String parentDir) Retrieve theFileInputStreamof the given filestatic Optional<InputStream>getInputStreamFromFileNameAndClassLoader(String fileName, ClassLoader classLoader)
-
Method Details
-
getFile
Retrieve theFileof 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
Retrieve theFileof the given file- Parameters:
fileName-parentDir-- Returns:
-
getFileInputStream
Retrieve theFileInputStreamof the given file- Parameters:
fileName-- Returns:
- Throws:
IOException
-
getFileInputStream
public static FileInputStream getFileInputStream(String fileName, String parentDir) throws IOException Retrieve theFileInputStreamof the given file- Parameters:
fileName-parentDir-- Returns:
- Throws:
IOException
-
getFileContent
Retrieve the content of the given file- Parameters:
fileName-- Returns:
- Throws:
IOException
-
getFileContent
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
delete a directory and all its content- Parameters:
path- path to the directory to delete
-