CompositeTextFileFactory
| Kind of class: | class |
|---|---|
| Inherits from: | BasicClass |
| Implements: | |
| Version: | 1.1 |
| Author: | Martin Heidegger |
| Classpath: | org.as2lib.io.file.CompositeTextFileFactory |
| File last modified: | Thursday, 13 October 2005, 18:03:26 |
CompositeTextFileFactory uses different TextFileFactoryimplementations depending to the extension of the passed-in
uri inFileFactory.createTextFile.Its a common case that different file extensions are used for different
kinds of file formats. CompositeTextFileFactory allows different processing
of resources depending to the extension of the loaded file.
If a certain extension has not been specially set it uses the defaultTextFileFactory
to be set with setDefaultTextFileFactory.
It uses SimpleTextFileFactory as default if no other has been set.
Summary
Constructor
Instance methods
- createTextFile
- setDefaultTextFileFactory
- putTextFileFactory
- putTextFileFactoryByExtension
- putTextFileFactoryByExtensions
Instance methods inherited from BasicClass
Constructor
CompositeTextFileFactory
function CompositeTextFileFactory (
Void)
Constructs a new
CompositeTextFileFactory.Instance methods
createTextFile
Creates a
TextFile implementation depending to the set TextFileFactorys.Parameters:
source:
content of the
TextFile to createsize :
size in org.as2lib.data.type.Byte of the loaded resource
uri :
location of the loaded resource
Returns:
TextFile that represents the resourceSpecified by:
putTextFileFactory
function putTextFileFactory (
)
putTextFileFactoryByExtension
function putTextFileFactoryByExtension (
extension:String,
fileFactory:TextFileFactory) : Void
Sets a certain
passed-in
TextFileFactory to be used for files with thepassed-in
extension.The passed-in extension should not contain a leading ".".
Proper example:
var textFileFactory:CompositeFileFactory = new CompositeTextFileFactory(); textFileFactory.putTextFileFactoryByExtension("txt", new SimpleTextFileFactory());
Parameters:
extension :
extension of the file that should be recognized by the
passed-in
passed-in
textFileFactorytextFileFactory:
TextFileFactory that creates the filesputTextFileFactoryByExtensions
function putTextFileFactoryByExtensions (
extensions:Array,
fileFactory:TextFileFactory) : Void
Sets a certain
of the passed-in
TextFileFactory to be used for files with one extensionof the passed-in
extensions.Any of the passed-in extension should not contain a leading ".".
Proper example:
var textFileFactory:CompositeTextFileFactory = new CompositeTextFileFactory(); textFileFactory.putTextFileFactoryByExtensions(["txt", "prop"], new SimpleTextFileFactory());
Parameters:
extensions :
list of extensions of files that should be recognized
by the passed-in
by the passed-in
textFileFactoryfileFactory:
TextFileFactory that creates the filessetDefaultTextFileFactory
function setDefaultTextFileFactory (
textFileFactory:TextFileFactory) : Void
Sets the default
TextFileFactory to be used in default case.If no other set TextFileFactory applies to the requested
uri the passed-in textFileFactory will be used.
Parameters:
textFileFactory:
TextFileFactory to be used in default case