Class FileUtil

java.lang.Object
ru.cg.webbpm.studio.core.api.io.FileUtil

public final class FileUtil extends Object
user: Ildar date: 06.03.15
  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • delete

      public static void delete(Path path) throws IOException
      Throws:
      IOException
    • assertNotExists

      public static void assertNotExists(Path path) throws IOException
      Throws:
      IOException
    • getState

      public static String getState(Path file) throws IOException
      Throws:
      IOException
    • deleteIfExists

      public static void deleteIfExists(Path path) throws IOException
      Throws:
      IOException
    • move

      public static Path move(Path target, Path newParent) throws IOException
      Throws:
      IOException
    • rename

      public static Path rename(Path target, String newName) throws IOException
      Throws:
      IOException
    • createFile

      public static Path createFile(Path file, String fileName) throws IOException
      Throws:
      IOException
    • createDirectory

      public static Path createDirectory(Path file, String dirName) throws IOException
      Throws:
      IOException
    • isContains

      public static boolean isContains(Path dir, Predicate<Path> predicate)
    • copyDirContent

      public static void copyDirContent(Path target, Path source) throws IOException
      Throws:
      IOException
    • copyDirContent

      public static void copyDirContent(Path target, Path source, FileFilter fileFilter) throws IOException
      Throws:
      IOException
    • unzip

      public static void unzip(Path zipFile, Path destDir)
      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 extract
      destDir - the directory to unzip to
    • checkExtension

      public static boolean checkExtension(Path file, String extension)
    • isEmpty

      public static boolean isEmpty(Path file)
      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

      public static String getFileName(Path fileName)
    • getFileExtension

      public static String getFileExtension(Path path)
    • matchPathToGlob

      public static boolean matchPathToGlob(Path path, String glob, Path baseDir)
    • getLibraryPathFromSystemProperties

      public static String getLibraryPathFromSystemProperties()
    • lockedSerialize

      public static void lockedSerialize(String data, Path path) throws IOException
      Throws:
      IOException