Package de.dlr.proseo.storagemgr.utils
Klasse FileUtils
java.lang.Object
de.dlr.proseo.storagemgr.utils.FileUtils
A utility class for common file operations. It provides methods to create,
manipulate, and delete files and directories, along with supporting
functionalities such as path handling and file property retrieval.
- Autor:
- Denys Chaykovskiy
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Create path directoriesboolean
createFile
(String content) Creates the file with the contentvoid
Create parent directoriesdelete()
Delete the file or the directory with its sub-directories and contained filesvoid
deleteEmptyDirectoriesToTop
(String directoryToDelete) Deletes empty directories recursively in the direction of rootDelete the fileGets the file contentlong
Gets the file sizegetPath()
Gets the path to fileboolean
Checks if the path points to an empty directoryvoid
Sets the path to fileboolean
synchroCreateFile
(String content, long waitTime, long fileCheckMaxCycles) Creates the file with the content in a synchro modus
-
Konstruktordetails
-
FileUtils
Constructor sets the path- Parameter:
path
- Path to file
-
-
Methodendetails
-
getPath
Gets the path to file- Gibt zurück:
- the path to file
-
setPath
Sets the path to file- Parameter:
path
- the path to set
-
createFile
Creates the file with the content- Parameter:
content
- Content of the file- Gibt zurück:
- true if file was successfully created
-
synchroCreateFile
Creates the file with the content in a synchro modus- Parameter:
content
- Content of the filewaitTime
- the wait time between each cycle of checking the file lock statusfileCheckMaxCycles
- file check max cycles- Gibt zurück:
- true if file was successfully created
-
getFileSize
public long getFileSize()Gets the file size- Gibt zurück:
- the file size
-
isEmptyDirectory
public boolean isEmptyDirectory()Checks if the path points to an empty directory- Gibt zurück:
- true if directory is empty
-
getFileContent
Gets the file content- Gibt zurück:
- the content of the file
-
createParentDirectories
Create parent directories- Löst aus:
IllegalStateException
- if cannot create dirIllegalArgumentException
-
createDirectories
Create path directories- Löst aus:
IllegalStateException
- if cannot create dirIllegalArgumentException
-
deleteFile
Delete the file- Gibt zurück:
- path to the deleted file
- Löst aus:
IOException
- if the file cannot be deleted
-
delete
Delete the file or the directory with its sub-directories and contained files- Gibt zurück:
- the paths to the deleted files and directories
- Löst aus:
IOException
- if the file or directory cannot be deleted
-
deleteEmptyDirectoriesToTop
Deletes empty directories recursively in the direction of root- Parameter:
directoryToDelete
- the path to the directory
-