Packagech.capi.net
Classpublic class ExtensionFileSelector
ImplementsILoadableFileSelector

Selector of ILoadableFile based on the extension.


Example
Add/Modify an extension :
  var selector:ExtensionFileSelector = new ExtensionFileSelector();
  selector.extensions.put("zip", LoadableFileType.BINARY);
  
  var factory:LoadableFileFactory = new LoadableFileFactory(selector);
  var file:ILoadableFile = factory.create("myFile.zip"); //creates a binary URLLoader-based ILoadableFile
  



Public Properties
 PropertyDefined by
  extensions : IMap
[read-only] Defines the mapping between the extensions and the file type issued from the LoadableFileType class constants.
ExtensionFileSelector
Public Methods
 MethodDefined by
  
Creates a new ExtensionFileSelector object.
ExtensionFileSelector
  
create(request:URLRequest, factory:LoadableFileFactory):ILoadableFile
Creates a ILoadableFile using the specified LoadableFileFactory.
ExtensionFileSelector
  
getExtension(request:URLRequest):String
Retrieves the extension.
ExtensionFileSelector
Property detail
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
ExtensionFileSelector()constructor
public function ExtensionFileSelector()

Creates a new ExtensionFileSelector object.

The following extensions are defined by default :

Method detail
create()method
public function create(request:URLRequest, factory:LoadableFileFactory):ILoadableFile

Creates a ILoadableFile using the specified LoadableFileFactory.

Parameters
request:URLRequest — The URLRequest.
 
factory:LoadableFileFactory — The LoadableFileFactory.

Returns
ILoadableFile — The created ILoadableFile object.

Throws
ExtensionNotDefinedError — If the extensions into the specified request was not found into the extensions map.
 
— If the file type is invalid.

See also

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.