TemporaryFile
Package: velox.api.layer1.common.temporaryfiles
Type: Class
Inheritance: java.lang.Object รขโ โ TemporaryFile
Descriptionโ
Manages files and folders inside temporary folder ensuring automatic deletion when unlocked or during startup. Only attempts to delete unlocked files/folders.
Constructorsโ
TemporaryFileโ
public TemporaryFile(Path pathToFile, boolean isDirectory)
Create a temporary file abstraction. Doesn't actually perform any filesystem operations yet.
Parameters:
pathToFile- Relative path to the new file/directory within bookmap temporary folderisDirectory- If true temporary file will be a directory, otherwise it's a plain file
TemporaryFileโ
protected TemporaryFile(TemporaryFileDirectory temporaryFolder, Path filePathRelativeToFolder, boolean isDirectory)
Methodsโ
getPathโ
public Path getPath()
Provides full normalized path to managed file
createโ
public void create()
Creates lock file and, if isDirectory set to true also creates the empty folder.
disposeโ
public void dispose()
Unlock the file/folder and remove it (recursively, if it's a folder). Throws an exception if something goes wrong.
disposeโ
public void dispose(boolean removeFile, boolean throwException)
Unlock the file/folder and can remove it (recursively, if it's a folder). Can throw an exception if something goes wrong.
Parameters:
removeFile- If true - remove the locked file/folderthrowException- If true - exception is thrown on failure. Otherwise it's logged but not thrown.