Class StoredFile

    • Constructor Detail

      • StoredFile

        public StoredFile()
    • Method Detail

      • getSize

        public long getSize()
        Description copied from interface: File
        Returns the size in bytes of the virtual file.
        Specified by:
        getSize in interface File
        Returns:
        the size in bytes
      • 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
        Overrides:
        getLastModified in class StoredResource
        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
      • getContent

        public FileContent getContent()
        Description copied from interface: File
        Provides access to file content. Calling any method on a file that does not exist will cause it to be created.
        Specified by:
        getContent in interface File
        Returns:
        the file content
      • rename

        public File 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 File
        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
      • moveTo

        public File 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 File
        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

        public File 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 File
        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
      • copyToIfNewer

        public File copyToIfNewer​(Folder folder)
        Description copied from interface: File
        RCopy this file to the specified folder if this file is newer than the destination.
        Specified by:
        copyToIfNewer in interface File
        Parameters:
        folder - the folder to copy the file to
        Returns:
        a new resource (the current resource will no longer exist
      • 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
      • write

        protected boolean write​(File file)
        Called to write the contents of another file to this file. This method is can optionally be implemented by subclasses to implement custom file copy strategies.
        Parameters:
        file - the file being written to this one
        Returns:
        if the write operation has been handled. Return false for standard stream based writes.