| Package | ch.capi.net |
| Class | public class FileTypeSelector |
| Inheritance | FileTypeSelector Object |
ILoadableFile based on the extension.
| Property | Defined By | ||
|---|---|---|---|
| defaultFileTypeSelector : FileTypeSelector [static] [read-only]
Defines a default simple FileTypeSelector object. | FileTypeSelector | ||
| extensions : IMap [read-only]
Defines the mapping between the extensions and the file type issued from
the LoadableFileType class constants. | FileTypeSelector | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a new FileTypeSelector object. | FileTypeSelector | ||
getExtension(request:URLRequest):String
Retrieves the extension. | FileTypeSelector | ||
getType(request:URLRequest):String
Creates a ILoadableFile using the specified LoadableFileFactory. | FileTypeSelector | ||
| defaultFileTypeSelector | property |
defaultFileTypeSelector:FileTypeSelector [read-only]
Defines a default simple FileTypeSelector object.
public static function get defaultFileTypeSelector():FileTypeSelector| extensions | property |
extensions:IMap [read-only]
Defines the mapping between the extensions and the file type issued from
the LoadableFileType class constants.
public function get extensions():IMapSee also
| FileTypeSelector | () | Constructor |
public function FileTypeSelector()
Creates a new FileTypeSelector object.
The following extensions are defined by default :
LoadableFileType.SWFLoadableFileType.VARIABLESLoadableFileType.TEXTLoadableFileType.TEXTLoadableFileType.SOUNDLoadableFileType.SOUNDLoadableFileType.SWFLoadableFileType.SWFLoadableFileType.SWFLoadableFileType.SWFLoadableFileType.TEXTLoadableFileType.TEXTLoadableFileType.BINARY| getExtension | () | method |
public function getExtension(request:URLRequest):StringRetrieves the extension.
Parameters
request:URLRequest — The URLRequest.
|
String — The extension of the file specified by the url.
|
| getType | () | method |
public function getType(request:URLRequest):String
Creates a ILoadableFile using the specified LoadableFileFactory.
Parameters
request:URLRequest — The URLRequest.
|
String — The created ILoadableFile object.
|
ch.capi.errors:ExtensionNotDefinedError If — the extensions in the specified request was
not found in the extensions map.
|
See also
var selector:FileTypeSelector = new FileTypeSelector();
selector.extensions.put("zip", LoadableFileType.BINARY);
var factory:LoadableFileFactory = new LoadableFileFactory();
factory.fileTypeSelector = selector;
var file:ILoadableFile = factory.create("myFile.zip"); //creates a binary URLLoader-based ILoadableFile