Class FileUtilitiesKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Boolean deleteQuietly(File $self) Try and delete this file or directory quietly.
      final static Double size(File $self) Acquire the size of this file or directory in bytes.
      final static List<File> regexWalk(File $self, List<Regex> filters, FileWalkDirection direction) Walk this directory and return all file-objects which match any of the regular expressions in the provided list.
      final static List<File> filteredWalk(File $self, List<String> filters, FilterType filterType, FileWalkDirection direction, Boolean recursive) Walk this directory and return all file-objects which match the specified filter-type using the passed list of filters.
      final static Unit create(File $self, Boolean createFileOrDir, Boolean asDirectory) All parent directories are created, but not the file itself.
      final static Boolean testFileWrite(File $self) Test whether files can be written to this file denoting a directory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • deleteQuietly

         final static Boolean deleteQuietly(File $self)

        Try and delete this file or directory quietly. Deleting something quietly means that

        • No guarantee is made whether the file or directory is successfully deleted

        • No exceptions are thrown if an error occurs

        • No information is carried outside should an exception occur, meaning you have no information about why the deletion, if it failed

        Returns:

        true if, and only if, the file or directory was deleted.

      • size

         final static Double size(File $self)

        Acquire the size of this file or directory in bytes. If this file-object denotes a directory, then the size of all files in the directory will be checked and the sum of them returned.

        Returns:

        The filesize of this file, or sum of sizes of all files in this directory.

      • regexWalk

         final static List<File> regexWalk(File $self, List<Regex> filters, FileWalkDirection direction)

        Walk this directory and return all file-objects which match any of the regular expressions in the provided list.

        Parameters:
        filters - List of regular expressions to use for filtering.
        direction - The direction in which to walk the directory.
        Returns:

        All files inside this directory which matched the given filters.

      • create

         final static Unit create(File $self, Boolean createFileOrDir, Boolean asDirectory)

        All parent directories are created, but not the file itself.

        createFileOrDir in combination with asDirectory will result in this file being treated as a directory. As such, all parents will be created, along with this file itself being created as a directory.

        createFileOrDir without asDirectory will result in this file being created as a file.

        Parameters:
        createFileOrDir - Whether the file or directory should be created.
        asDirectory - true to create a directory, false to create a file.