Packagech.capi.net
Classpublic class FileTypeSelector
InheritanceFileTypeSelector Inheritance Object

Selector of ILoadableFile based on the extension.

View the examples



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Property Detail
defaultFileTypeSelectorproperty
defaultFileTypeSelector:FileTypeSelector  [read-only]

Defines a default simple FileTypeSelector object.


Implementation
    public static function get defaultFileTypeSelector():FileTypeSelector
extensionsproperty 
extensions:IMap  [read-only]

Defines the mapping between the extensions and the file type issued from the LoadableFileType class constants.


Implementation
    public function get extensions():IMap

See also

Constructor Detail
FileTypeSelector()Constructor
public function FileTypeSelector()

Creates a new FileTypeSelector object.

The following extensions are defined by default :

Method Detail
getExtension()method
public function getExtension(request:URLRequest):String

Retrieves the extension.

Parameters

request:URLRequest — The URLRequest.

Returns
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.

Returns
String — The created ILoadableFile object.

Throws
ch.capi.errors:ExtensionNotDefinedError If — the extensions in the specified request was not found in the extensions map.

See also

Examples
Add/Modify an extension :
     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