Class AbstractPlatformFile

  • All Implemented Interfaces:
    ProgressListenable<java.lang.Long>, PlatformFile
    Direct Known Subclasses:
    WebPlatformFile

    public abstract class AbstractPlatformFile
    extends java.lang.Object
    implements PlatformFile
    An abstract implementation of a local file on a platform.
    Author:
    Garret Wilson
    • Constructor Detail

      • AbstractPlatformFile

        public AbstractPlatformFile​(java.lang.String name,
                                    long size)
        Name and size constructor.
        Parameters:
        name - The name of the file.
        size - The size of the file, or -1 if the size is unknown.
        Throws:
        java.lang.NullPointerException - if the given name is null.
    • Method Detail

      • getEventListenerManager

        protected com.globalmentor.event.EventListenerManager getEventListenerManager()
        Returns:
        The object managing event listeners.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface PlatformFile
        Returns:
        The name of the file.
      • getSize

        public long getSize()
        Specified by:
        getSize in interface PlatformFile
        Returns:
        The size of the file, or -1 if the size is unknown.
      • fireProgressed

        protected void fireProgressed​(com.globalmentor.model.TaskState state,
                                      long transferred,
                                      long total)
        Fires a progress event to all registered progress listeners. This method delegates to fireProgressed(ProgressEvent).
        Parameters:
        state - The state of the progress.
        transferred - The current number of bytes transferred, or -1 if not known.
        total - The total or estimated total bytes to transfer, or -1 if not known.
        Throws:
        java.lang.NullPointerException - if the given state is null.
        See Also:
        ProgressListener, ProgressEvent
      • fireProgressed

        protected void fireProgressed​(ProgressEvent<java.lang.Long> progressEvent)
        Fires a given progress event to all registered progress listeners.
        Parameters:
        progressEvent - The progress event to fire.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object