Class org.as2lib.io.file.AbstractFileLoader

Implemented Interfaces

FileLoader

Description

AbstractFileLoader is a abstract implementation for a FileLoader.

Extend AbstractFileLoader to implement most methods required for a ResourceLoader.

Field Index

FILE_NOT_FOUND_ERROR

Inherited from LogSupport

Method Index

new AbstractFileLoader()
getBytesLoaded(), getBytesTotal(), getFile(), getParameters(), getParameterSubmitMethod(), getPercentage(), getTransferRate(), getUri(), load()

Inherited from AbstractTimeConsumer

Inherited from EventSupport

Inherited from LogSupport

Inherited from BasicClass

Constructor Detail

AbstractFileLoader

function AbstractFileLoader(Void)

Constructs a new AbstractFileLoader

Pass all arguments from the extended constructor by using super to add the parameters to the instance.

Field Detail

FILE_NOT_FOUND_ERROR

static public FILE_NOT_FOUND_ERROR:String
Error code if a certain file could not be found.

Method Detail

getUri

public function getUri(Void):String

Returns for the location of the resource that was requested to load.

Return

location of the resource to load

Specified By

getUri() in org.as2lib.io.file.FileLoader

getPercentage

public function getPercentage(Void):Number

Returns the pecentage of the file that has been loaded.

Evaluates the current percentage of the execution by using getBytesTotal and getBytesLoaded.

Returns null if the percentage is not evaluable

Return

percentage of the file that has been loaded

Specified By

getPercentage() in org.as2lib.io.file.FileLoader

Overrides

getPercentage() in org.as2lib.app.exec.AbstractTimeConsumer

getTransferRate

public function getTransferRate(Void):Bit

Returns the current transfer rate for the execution.

Evalutes the transfer rate by using getBytesLoaded and getDuration.

Return

transfer rate in bit (per second)

Specified By

getTransferRate() in org.as2lib.io.file.FileLoader

getBytesTotal

public function getBytesTotal(Void):Byte

Stub implementation for the amount of bytes that were loaded.

Return

null for not evaluable

Specified By

getBytesTotal() in org.as2lib.io.file.FileLoader

getBytesLoaded

public function getBytesLoaded(Void):Byte

Stub implementation for the amount of bytes to be loaded.

Return

null for not evaluable

Specified By

getBytesLoaded() in org.as2lib.io.file.FileLoader

load

public function load(uri:String, method:String, parameters:Map, callBack:Executable):Void

Prepares the loading of a certain file.

To be overwritten with the concrete load implentation. Do not forget to apply super.load().

Parameters

urilocation of the resource to load
method(optional) POST/GET as method for submitting the parameters, default method used if method was not passed-in is POST.
parameters(optional) parameters for loading the resource
callBack(optional) Executable to be executed after the the resource was loaded.

Specified By

load() in org.as2lib.io.file.FileLoader

getParameterSubmitMethod

public function getParameterSubmitMethod(Void):String

Returns the method to pass request parameters for request.

Return

method to pass request parameters

Specified By

getParameterSubmitMethod() in org.as2lib.io.file.FileLoader

getParameters

public function getParameters(Void):Map

Sets the parameters for the request to the resource.

Returns null if no parameters has been set.

Return

parameters to be passed with the resource request

Specified By

getParameters() in org.as2lib.io.file.FileLoader

getFile

public function getFile(Void):File

Returns the loaded resource.

Return

the loaded resource

Throws

org.as2lib.io.file.ResourceNotLoadedExceptionif the resource has not been loaded yet

Specified By

getFile() in org.as2lib.io.file.FileLoader