Package ru.cg.webbpm.studio.core.api.io
Class FileUtil
java.lang.Object
ru.cg.webbpm.studio.core.api.io.FileUtil
user: Ildar
date: 06.03.15
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertNotExists
(Path path) static boolean
checkExtension
(Path file, String extension) static void
copyDirContent
(Path target, Path source) static void
copyDirContent
(Path target, Path source, FileFilter fileFilter) static Path
createDirectory
(Path file, String dirName) static Path
createFile
(Path file, String fileName) static void
static void
deleteIfExists
(Path path) findChangedFiles
(Path folder, long timeInMilli, String... filesExtension) findChangedFiles
(Path folder, long timeInMilli, Predicate<Path> predicate) Получить измененные или добавленные файлы в директорииstatic String
getFileExtension
(Path path) static String
getFileName
(Path fileName) static String
static String
static boolean
isContains
(Path dir, Predicate<Path> predicate) static boolean
Tries to determine file size, treating IOException as an indication of empty filestatic void
lockedSerialize
(String data, Path path) static boolean
matchPathToGlob
(Path path, String glob, Path baseDir) static Path
static Path
static void
Unzips the specified zip file to the specified destination directory.
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
delete
- Throws:
IOException
-
assertNotExists
- Throws:
IOException
-
getState
- Throws:
IOException
-
deleteIfExists
- Throws:
IOException
-
move
- Throws:
IOException
-
rename
- Throws:
IOException
-
createFile
- Throws:
IOException
-
createDirectory
- Throws:
IOException
-
isContains
-
copyDirContent
- Throws:
IOException
-
copyDirContent
public static void copyDirContent(Path target, Path source, FileFilter fileFilter) throws IOException - Throws:
IOException
-
unzip
Unzips the specified zip file to the specified destination directory. Replaces any files in the destination, if they already exist.- Parameters:
zipFile
- the name of the zip file to extractdestDir
- the directory to unzip to
-
checkExtension
-
isEmpty
Tries to determine file size, treating IOException as an indication of empty file- Parameters:
file
- path to the file- Returns:
- true if the file is empty or if an IOException occurs, false otherwise
-
findChangedFiles
public static Set<Path> findChangedFiles(Path folder, long timeInMilli, Predicate<Path> predicate) throws IOException Получить измененные или добавленные файлы в директорииВНИМАНИЕ, учитываются только секунды
- Parameters:
folder
- - директория поискаtimeInMilli
- - время последнего изменения, добавленияpredicate
- - дополнительное условие- Throws:
IOException
-
findChangedFiles
public static Set<Path> findChangedFiles(Path folder, long timeInMilli, String... filesExtension) throws IOException - Throws:
IOException
-
getFileName
-
getFileExtension
-
matchPathToGlob
-
getLibraryPathFromSystemProperties
-
lockedSerialize
- Throws:
IOException
-