Package | deng.fzip |
Class | public class FZip |
Inheritance | FZip flash.events.EventDispatcher |
FZip is able to process, create and modify standard ZIP archives as described in the PKZIP file format documentation.
Limitations:
Property | Defined by | ||
---|---|---|---|
active : Boolean [read-only]
Indicates whether a file is currently being processed or not.
| FZip |
Method | Defined by | ||
---|---|---|---|
FZip(filenameEncoding:String = "utf-8")
Constructor
| FZip | ||
Adds a file to the ZIP archive.
| FZip | ||
Adds a file to the ZIP archive, at a specified index.
| FZip | ||
addFileFromString(name:String, content:String, charset:String = "utf-8"):FZipFile
Adds a file from a String to the ZIP archive.
| FZip | ||
addFileFromStringAt(index:uint, name:String, content:String, charset:String = "utf-8"):FZipFile
Adds a file from a String to the ZIP archive, at a specified index.
| FZip | ||
close():void
Immediately closes the stream and cancels the download operation.
| FZip | ||
Retrieves a file contained in the ZIP archive, by index.
| FZip | ||
getFileByName(name:String):FZipFile
Retrieves a file contained in the ZIP archive, by filename.
| FZip | ||
getFileCount():uint
Gets the number of accessible files in the ZIP archive.
| FZip | ||
load(request:URLRequest):void
Begins downloading the ZIP archive specified by the request
parameter.
| FZip | ||
loadBytes(bytes:ByteArray):void
Loads a ZIP archive from a ByteArray.
| FZip | ||
removeFileAt(index:uint):FZipFile
Removes a file at a specified index from the ZIP archive.
| FZip | ||
serialize(stream:IDataOutput, includeAdler32:Boolean = false):void
Serializes this zip archive into an IDataOutput stream (such as
ByteArray or FileStream) according to PKZIP APPNOTE.TXT
| FZip |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when data has loaded successfully. | FZip | |||
Dispatched when a file contained in a ZIP archive has loaded successfully. | FZip | |||
Dispatched if a call to FZip.load() attempts to access data over HTTP, and the current Flash Player is able to detect and return the status code for the request. | FZip | |||
Dispatched when an input/output error occurs that causes a load operation to fail. | FZip | |||
Dispatched when a load operation starts. | FZip | |||
Dispatched when an error is encountered while parsing a ZIP Archive. | FZip | |||
Dispatched when data is received as the download operation progresses. | FZip | |||
Dispatched if a call to FZip.load() attempts to load data from a server outside the security sandbox. | FZip |
active | property |
active:Boolean
[read-only]Indicates whether a file is currently being processed or not.
Implementation public function get active():Boolean
FZip | () | constructor |
public function FZip(filenameEncoding:String = "utf-8")
Constructor
ParametersfilenameEncoding:String (default = "utf-8 ") — The character encoding used for filenames
contained in the zip. If unspecified, unicode ("utf-8") is used.
Older zips commonly use encoding "IBM437" (aka "cp437"),
while other European countries use "ibm850".
|
See also
addFile | () | method |
public function addFile(name:String, content:ByteArray = null):FZipFile
Adds a file to the ZIP archive.
Parametersname:String — The filename
|
|
content:ByteArray (default = null ) — The ByteArray containing the uncompressed data (pass null to add a folder)
|
FZipFile —
A reference to the newly created FZipFile object
|
addFileAt | () | method |
public function addFileAt(index:uint, name:String, content:ByteArray = null):FZipFile
Adds a file to the ZIP archive, at a specified index.
Parametersindex:uint — The index
|
|
name:String — The filename
|
|
content:ByteArray (default = null ) — The ByteArray containing the uncompressed data (pass null to add a folder)
|
FZipFile —
A reference to the newly created FZipFile object
|
addFileFromString | () | method |
public function addFileFromString(name:String, content:String, charset:String = "utf-8"):FZipFile
Adds a file from a String to the ZIP archive.
Parametersname:String — The filename
|
|
content:String — The String
|
|
charset:String (default = "utf-8 ") — The character set
|
FZipFile —
A reference to the newly created FZipFile object
|
addFileFromStringAt | () | method |
public function addFileFromStringAt(index:uint, name:String, content:String, charset:String = "utf-8"):FZipFile
Adds a file from a String to the ZIP archive, at a specified index.
Parametersindex:uint — The index
|
|
name:String — The filename
|
|
content:String — The String
|
|
charset:String (default = "utf-8 ") — The character set
|
FZipFile —
A reference to the newly created FZipFile object
|
close | () | method |
public function close():void
Immediately closes the stream and cancels the download operation. Files contained in the ZIP archive being loaded stay accessible through the getFileAt() and getFileByName() methods.
getFileAt | () | method |
public function getFileAt(index:uint):FZipFile
Retrieves a file contained in the ZIP archive, by index.
Parametersindex:uint — The index of the file to retrieve
|
FZipFile —
A reference to a FZipFile object
|
getFileByName | () | method |
public function getFileByName(name:String):FZipFile
Retrieves a file contained in the ZIP archive, by filename.
Parametersname:String — The filename of the file to retrieve
|
FZipFile —
A reference to a FZipFile object
|
getFileCount | () | method |
public function getFileCount():uint
Gets the number of accessible files in the ZIP archive.
Returnsuint — The number of files
|
load | () | method |
public function load(request:URLRequest):void
Begins downloading the ZIP archive specified by the request parameter.
Parametersrequest:URLRequest — A URLRequest object specifying the URL of a ZIP archive
to download.
If the value of this parameter or the URLRequest.url property
of the URLRequest object passed are null, Flash Player throws
a null pointer error.
|
loadBytes | () | method |
public function loadBytes(bytes:ByteArray):void
Loads a ZIP archive from a ByteArray.
Parametersbytes:ByteArray — The ByteArray containing the ZIP archive
|
removeFileAt | () | method |
public function removeFileAt(index:uint):FZipFile
Removes a file at a specified index from the ZIP archive.
Parametersindex:uint — The index
|
FZipFile —
A reference to the removed FZipFile object
|
serialize | () | method |
public function serialize(stream:IDataOutput, includeAdler32:Boolean = false):void
Serializes this zip archive into an IDataOutput stream (such as ByteArray or FileStream) according to PKZIP APPNOTE.TXT
Parametersstream:IDataOutput — The stream to serialize the zip file into.
|
|
includeAdler32:Boolean (default = false ) — To decompress compressed files, FZip needs Adler32
checksums to be injected into the zipped files. FZip will do that
automatically if includeAdler32 is set to true. Note that if the
ZIP contains a lot of files, or big files, the calculation of the
checksums may take a while.
|
complete | event |
fileLoaded | event |
deng.fzip.FZipEvent
Dispatched when a file contained in a ZIP archive has loaded successfully.
httpStatus | event |
flash.events.HTTPStatusEvent
Dispatched if a call to FZip.load() attempts to access data over HTTP, and the current Flash Player is able to detect and return the status code for the request. (Some browser environments may not be able to provide this information.) Note that the httpStatus (if any) will be sent before (and in addition to) any complete or error event
ioError | event |
flash.events.IOErrorEvent
Dispatched when an input/output error occurs that causes a load operation to fail.
open | event |
parseError | event |
deng.fzip.FZipErrorEvent
Dispatched when an error is encountered while parsing a ZIP Archive.
progress | event |
flash.events.ProgressEvent
Dispatched when data is received as the download operation progresses.
securityError | event |
flash.events.SecurityErrorEvent
Dispatched if a call to FZip.load() attempts to load data from a server outside the security sandbox.