Class Folder

    • Constructor Detail

      • Folder

        public Folder​(Folder parent,
                      String child)
        Constructor.
        Parameters:
        parent - parent
        child - child
      • Folder

        public Folder​(File file)
        Construct.
        Parameters:
        file - File
      • Folder

        public Folder​(String pathname)
        Constructor.
        Parameters:
        pathname - path name
      • Folder

        public Folder​(String parent,
                      String child)
        Constructor.
        Parameters:
        parent - parent
        child - child
      • Folder

        public Folder​(URI uri)
        Constructor.
        Parameters:
        uri - folder uri
    • Method Detail

      • ensureExists

        public void ensureExists()
                          throws IOException
        Does a mkdirs() on this folder if it does not exist. If the folder cannot be created, an IOException is thrown.
        Throws:
        IOException - Thrown if folder cannot be created
      • folder

        public Folder folder​(String name)
        Parameters:
        name - Name of child folder
        Returns:
        Child file object
      • freeDiskSpace

        public Bytes freeDiskSpace()
        Returns:
        Disk space free on the partition where this folder lives
      • getFiles

        public File[] getFiles()
        Returns:
        Files in this folder
      • getNestedFiles

        public File[] getNestedFiles()
        Returns:
        All files nested within this folder
      • getNestedFiles

        public File[] getNestedFiles​(Folder.FileFilter filter)
        Gets files in this folder matching a given filter recursively.
        Parameters:
        filter - The filter
        Returns:
        The list of files
      • getFolders

        public Folder[] getFolders()
        Gets all folders in this folder, except "." and ".."
        Returns:
        Folders
      • remove

        public boolean remove()
        Removes this folder and everything in it, recursively. A best effort is made to remove nested folders and files in depth-first order.
        Overrides:
        remove in class File
        Returns:
        True if the folder was successfully removed
        See Also:
        File.delete()
      • removeFiles

        public boolean removeFiles()
        Removes all the files in this folder.
        Returns:
        True if any files were successfully removed