Package io.guise.framework.platform.web
Class WebPlatformFile
- java.lang.Object
-
- io.guise.framework.platform.AbstractPlatformFile
-
- io.guise.framework.platform.web.WebPlatformFile
-
- All Implemented Interfaces:
ProgressListenable<java.lang.Long>
,PlatformFile
public class WebPlatformFile extends AbstractPlatformFile
A local file represented by a Flashflash.net.FileReference
on the web platform. Because Flash registers progress listeners on a per-file basis, this file keeps track of a single listener, available only to web classes (as other upload implementations may not register listeners for individual files).- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description WebPlatformFile(PlatformFileCollector fileReferenceList, java.lang.String id, java.lang.String name, long size)
File reference list, name and size constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancels the current upload or download.protected void
fireProgressed(com.globalmentor.model.TaskState state, long transferred, long total)
Fires a progress event to all registered progress listeners.java.lang.String
getID()
protected PlatformFileCollector
getPlatformFileCollector()
void
upload(java.net.URI destinationURI)
Uploads the file from the platform.-
Methods inherited from class io.guise.framework.platform.AbstractPlatformFile
addProgressListener, fireProgressed, getEventListenerManager, getName, getSize, removeProgressListener, toString
-
-
-
-
Constructor Detail
-
WebPlatformFile
public WebPlatformFile(PlatformFileCollector fileReferenceList, java.lang.String id, java.lang.String name, long size)
File reference list, name and size constructor.- Parameters:
fileReferenceList
- The Flash file reference list that owns this platform file.id
- The ID given to the file by Flash.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 ID, file reference list, and/or name isnull
.
-
-
Method Detail
-
getPlatformFileCollector
protected PlatformFileCollector getPlatformFileCollector()
- Returns:
- The platform file collector that owns this platform file.
-
getID
public java.lang.String getID()
- Returns:
- The ID given to the file by Flash.
-
upload
public void upload(java.net.URI destinationURI)
Description copied from interface:PlatformFile
Uploads the file from the platform.- Parameters:
destinationURI
- The URI representing the destination of the platform file, either absolute or relative to the application.
-
cancel
public void cancel()
Description copied from interface:PlatformFile
Cancels the current upload or download.
-
fireProgressed
protected void fireProgressed(com.globalmentor.model.TaskState state, long transferred, long total)
Description copied from class:AbstractPlatformFile
Fires a progress event to all registered progress listeners. This method delegates toAbstractPlatformFile.fireProgressed(ProgressEvent)
.- Overrides:
fireProgressed
in classAbstractPlatformFile
- 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.- See Also:
ProgressListener
,ProgressEvent
-
-