Class StoredFolder

    • Constructor Detail

      • StoredFolder

        public StoredFolder()
    • Method Detail

      • getExisting

        public Resource getExisting​(java.lang.String name)
        Description copied from interface: Folder
        Return a child from the current folder that refers to an existing File or Folder. If the name includes '/' characters then the file will be returned from nested folders. Paths are relative unless they begin with '/', in which case they are taken from the topmost parent. Use '..' to refer to a parent folder.
        Specified by:
        getExisting in interface Folder
        Parameters:
        name - the name of the resource
        Returns:
        a File or Folder resource
        See Also:
        Folder.hasExisting(String)
      • hasExisting

        public boolean hasExisting​(java.lang.String name)
        Description copied from interface: Folder
        Returns true if this folder already contains a resource with the specified name. This method supports the same naming rules as Folder.getExisting(String).
        Specified by:
        hasExisting in interface Folder
        Parameters:
        name - the name of the resource
        Returns:
        true if the resource is contained in the folder
        See Also:
        Folder.getExisting(String)
      • getFolder

        public Folder getFolder​(java.lang.String name)
        Description copied from interface: Folder
        Get a child folder of the current folder. This method supports the same naming rules as Folder.getExisting(String).
        Specified by:
        getFolder in interface Folder
        Parameters:
        name - the name of the folder to get
        Returns:
        the Folder
      • getFile

        public File getFile​(java.lang.String name)
        Description copied from interface: Folder
        Get a child file of the current folder. This method supports the same naming rules as Folder.getExisting(String).
        Specified by:
        getFile in interface Folder
        Parameters:
        name - the name of the file to get
        Returns:
        the File
      • iterator

        public java.util.Iterator<Resource> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Resource>
      • list

        public Resources<Resource> list()
        Description copied from interface: Folder
        List all immediate child resources of this folder. If this resource does not exist empty resources are returned.
        Specified by:
        list in interface Folder
        Returns:
        a list of all immediate child resources
      • find

        public Resources<Resource> find()
        Description copied from interface: Folder
        Recursively find all immediate and nested children of this folder. If this resource does not exist empty resources are returned.
        Specified by:
        find in interface Folder
        Returns:
        a list of all nested children
      • copyTo

        public Folder copyTo​(Folder folder)
        Description copied from interface: Resource
        Recursively copy this resource to the specified folder. Any duplicate Files will be replaced (existing Folder resources will be merged). If the resource does not exist a ResourceDoesNotExistException is thrown.
        Specified by:
        copyTo in interface Folder
        Specified by:
        copyTo in interface Resource
        Parameters:
        folder - the folder to copy the resource to
        Returns:
        a new resource (the current resource will no longer exist
      • moveTo

        public Folder moveTo​(Folder folder)
        Description copied from interface: Resource
        Move this resource to the specified folder. Any duplicate Files will be replaced (existing Folder resources will be merged). If the resource does not exist a ResourceDoesNotExistException is thrown.
        Specified by:
        moveTo in interface Folder
        Specified by:
        moveTo in interface Resource
        Parameters:
        folder - the folder to move the resource to
        Returns:
        a new resource (the current resource will no longer exist
      • rename

        public Folder rename​(java.lang.String name)
        Description copied from interface: Resource
        Rename the current resource. The rename operation cannot be used not move the resource to a different folder, use the Resource.moveTo(Folder) method to move the resource before renaming if required. Root folders cannot be renamed. If the resource does not exist a ResourceDoesNotExistException is thrown.
        Specified by:
        rename in interface Folder
        Specified by:
        rename in interface Resource
        Overrides:
        rename in class StoredResource
        Parameters:
        name - the new name of the resource (this must not include any path elements)
        Returns:
        a new resource (the current resource will no longer exist
      • delete

        public void delete()
        Description copied from interface: Resource
        Delete the current resource (and any children). If this resource does not exist then no operation is performed.
        Specified by:
        delete in interface Resource
      • createIfMissing

        public void createIfMissing()
        Description copied from interface: Resource
        Recursively creates an empty representation of this resource and all parents. Calling this method on an existing resource has not effect.
        Specified by:
        createIfMissing in interface Resource
      • jail

        public Folder jail()
        Description copied from interface: Folder
        Return a new folder that is jailed at the current location. A jailed folder acts as a root folder at the current location.
        Specified by:
        jail in interface Folder
        Returns:
        a new jailed folder