Package io.guise.framework.platform
Class AbstractPlatformFile
java.lang.Object
io.guise.framework.platform.AbstractPlatformFile
- All Implemented Interfaces:
ProgressListenable<Long>
,PlatformFile
- Direct Known Subclasses:
WebPlatformFile
An abstract implementation of a local file on a platform.
- Author:
- Garret Wilson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProgressListener
(ProgressListener<Long> progressListener) Adds a progress listener.protected void
fireProgressed
(com.globalmentor.model.TaskState state, long transferred, long total) Fires a progress event to all registered progress listeners.protected void
fireProgressed
(ProgressEvent<Long> progressEvent) Fires a given progress event to all registered progress listeners.protected com.globalmentor.event.EventListenerManager
getName()
long
getSize()
void
removeProgressListener
(ProgressListener<Long> progressListener) Removes an progress listener.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.guise.framework.platform.PlatformFile
cancel, upload
-
Constructor Details
-
AbstractPlatformFile
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:
NullPointerException
- if the given name isnull
.
-
-
Method Details
-
getEventListenerManager
protected com.globalmentor.event.EventListenerManager getEventListenerManager()- Returns:
- The object managing event listeners.
-
getName
- Specified by:
getName
in interfacePlatformFile
- Returns:
- The name of the file.
-
getSize
public long getSize()- Specified by:
getSize
in interfacePlatformFile
- Returns:
- The size of the file, or -1 if the size is unknown.
-
addProgressListener
Description copied from interface:ProgressListenable
Adds a progress listener.- Specified by:
addProgressListener
in interfaceProgressListenable<Long>
- Parameters:
progressListener
- The progress listener to add.
-
removeProgressListener
Description copied from interface:ProgressListenable
Removes an progress listener.- Specified by:
removeProgressListener
in interfaceProgressListenable<Long>
- Parameters:
progressListener
- The progress listener to remove.
-
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 tofireProgressed(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:
NullPointerException
- if the given state isnull
.- See Also:
-
fireProgressed
Fires a given progress event to all registered progress listeners.- Parameters:
progressEvent
- The progress event to fire.
-
toString
-