Class FileUtilsExtra
java.lang.Object
org.aksw.commons.txn.impl.FileUtilsExtra
Eventually these file utils should be consolidated with those in aksw-commons-io.
However, my feel is that first there should be a little framework that allows for
modeling actions that have multiple prerequisites such as the existence of certain folders.
These utils here only allow for a single prerequisite.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TensureFolderExists(Path folderPath, Callable<T> action) Repeatedly retry to create the given file's parent folder and then perform an action based on that folder.static <T> TensureFolderExists(Path folderPath, ThrowingRunnable action) static <T> TensureParentFolderExists(Path childPath, Callable<T> action) static <T> TensureParentFolderExists(Path childPath, ThrowingRunnable action) streamFilenames(Path folder)
-
Constructor Details
-
FileUtilsExtra
public FileUtilsExtra()
-
-
Method Details
-
streamFilenames
- Throws:
IOException
-
ensureParentFolderExists
public static <T> T ensureParentFolderExists(Path childPath, ThrowingRunnable action) throws IOException - Throws:
IOException
-
ensureParentFolderExists
- Throws:
IOException
-
ensureFolderExists
- Throws:
IOException
-
ensureFolderExists
Repeatedly retry to create the given file's parent folder and then perform an action based on that folder. Uses 10 retries with 100ms delay before failing. Useful if another process concurrently perform a 'deleteEmptyFolders' action an the same folder- Parameters:
action-path-- Throws:
IOException
-