Interface Folder

    • Method Detail

      • moveTo

        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 Resource
        Parameters:
        folder - the folder to move the resource to
        Returns:
        a new resource (the current resource will no longer exist
      • copyTo

        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 Resource
        Parameters:
        folder - the folder to copy the resource to
        Returns:
        a new resource (the current resource will no longer exist
      • rename

        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 Resource
        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
      • getExisting

        Resource getExisting​(java.lang.String name)
        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.
        Parameters:
        name - the name of the resource
        Returns:
        a File or Folder resource
        Throws:
        ResourceDoesNotExistException - if the resource does not exist
        See Also:
        hasExisting(String)
      • hasExisting

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

        Folder getFolder​(java.lang.String name)
        Get a child folder of the current folder. This method supports the same naming rules as getExisting(String).
        Parameters:
        name - the name of the folder to get
        Returns:
        the Folder
        Throws:
        ResourceTypeMismatchException - if the an existing resource exits that is not a folder
      • getFile

        File getFile​(java.lang.String name)
        Get a child file of the current folder. This method supports the same naming rules as getExisting(String).
        Parameters:
        name - the name of the file to get
        Returns:
        the File
        Throws:
        ResourceTypeMismatchException - if the an existing resource exits that is not a file
      • list

        Resources<Resource> list()
        List all immediate child resources of this folder. If this resource does not exist empty resources are returned.
        Returns:
        a list of all immediate child resources
      • find

        Resources<Resource> find()
        Recursively find all immediate and nested children of this folder. If this resource does not exist empty resources are returned.
        Returns:
        a list of all nested children
      • jail

        Folder jail()
        Return a new folder that is jailed at the current location. A jailed folder acts as a root folder at the current location.
        Returns:
        a new jailed folder