Class StoredResource

    • Constructor Detail

      • StoredResource

        public StoredResource()
    • Method Detail

      • ensureExists

        protected final void ensureExists()
      • createParentIfMissing

        protected final void createParentIfMissing()
      • getParent

        public Folder getParent()
        Description copied from interface: Resource
        Returns the parent folder of the resource or null if this is the root folder.
        Specified by:
        getParent in interface Resource
        Returns:
        the parent folder or null
      • getName

        public java.lang.String getName()
        Description copied from interface: Resource
        Returns the name of the resource. This name does not include any path element. Root folders will have an empty string name.
        Specified by:
        getName in interface Resource
        Returns:
        the name of the resource, for example "file.txt"
      • rename

        public Resource 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
      • exists

        public boolean exists()
        Description copied from interface: Resource
        Returns true if the resource exists in the underlying store.
        Specified by:
        exists in interface Resource
        Returns:
        true if the resource exists.
      • toStringRelativeTo

        public java.lang.String toStringRelativeTo​(Folder source)
        Description copied from interface: Resource
        Returns the the complete name of this resource (including path elements) relative to the specified source folder. The source must be a parent (or grandparent etc) of this resource. If the source is this folder an empty String is returned. The returned value does not include any leading slash, for example: '/a/b/c.txt' relative to '/a/' will return 'b/c.txt'.
        Specified by:
        toStringRelativeTo in interface Resource
        Parameters:
        source - the source folder
        Returns:
        the name
        See Also:
        Resource.toString(), Resource.toStringRelativeTo(Folder)
      • isRelativeTo

        public boolean isRelativeTo​(Folder folder)
        Specified by:
        isRelativeTo in interface Resource
        Returns:
        true if the given param folder is relative to comprising folder object, else return false
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from interface: Resource
        Determines if this resource is equal to another object. Any resources that have the same type, path and are stored in the same underlying system are considered equal.
        Specified by:
        equals in interface Resource
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare to
        Returns:
        true if the resource is equal to the specified object.
      • isModifiedAfter

        public boolean isModifiedAfter​(long n)
        Specified by:
        isModifiedAfter in interface Resource
      • getLastModified

        public long getLastModified()
        Description copied from interface: Resource
        Gets the time this resource object was last modified. The time is measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
        Specified by:
        getLastModified in interface Resource
        Returns:
        the time this resource object was last modified; or 0 if the resource object does not exist, if an I/O error occurred, or if the operation is not supported