Package | de.popforge.format.furnace |
Class | public class FurnaceFormat |
Implements | flash.utils.IExternalizable |
IExternalizable
it can be passed
to a class that implements IDataOutput
.
Using registerClassAlias
makes calls to IDataInput.readObject()
or IDataOutput.writeObject()
possible.
The furnace file format supports streaming and has been designed for fast and easy read access.
The file structure is like this:
Header:
Length | Type | Description |
---|---|---|
3b | String | Identifier (should be "FUR") |
4b | uint | Total filesize in bytes (including header) |
4b | Number | Format version |
4b | uint | Number of files |
Item:
Length | Type | Description |
---|---|---|
2b | uint | Length of UTF encoded name in bytes |
LEN bytes | String | Filename |
4b | uint | Position of file data |
4b | uint | Length of the file in bytes |
Data: Raw GZip encoded file data.
Property | Defined by | ||
---|---|---|---|
_header : FurnaceHeader
A reference to the file header.
| FurnaceFormat | ||
_items : Array
Array of
FurnaceItem items. | FurnaceFormat | ||
_library : Array
Array of file content represented as
ByteArray objects. | FurnaceFormat | ||
numFiles : uint [read-only]
The number of items in the package.
| FurnaceFormat |
Method | Defined by | ||
---|---|---|---|
Creates a new FurnaceFormat object.
| FurnaceFormat | ||
addFile(file:ByteArray, name:String):uint
Adds a new file to the format.
| FurnaceFormat | ||
fileById(index:uint):ByteArray
Returns the file at given item index.
| FurnaceFormat | ||
fileByName(fileName:String):ByteArray
Returns the file with given name.
| FurnaceFormat | ||
fileName(index:uint):String
Returns the filename at given index.
| FurnaceFormat | ||
readExternal(input:IDataInput):void
Reads the furnace format from a given
IDataInput stream. | FurnaceFormat | ||
toString():String
Creates and returns a string representation of the object.
| FurnaceFormat | ||
writeExternal(output:IDataOutput):void
Writes the furnace format to a given
IDataOutput stream. | FurnaceFormat |
Method | Defined by | ||
---|---|---|---|
compressLibrary():void
Compresses all objects that are in the library.
| FurnaceFormat | ||
testBounds(index:uint):void
Tests if an index is out of bounds.
| FurnaceFormat | ||
uncompressLibrary():void
Uncompresses all objects that are in the library.
| FurnaceFormat |
Constant | Defined by | ||
---|---|---|---|
VERSION : Number = 1.0 [static]
Actual version of the format.
| FurnaceFormat |
_header | property |
public var _header:FurnaceHeader
A reference to the file header.
_items | property |
public var _items:Array
Array of FurnaceItem
items.
_library | property |
public var _library:Array
Array of file content represented as ByteArray
objects.
numFiles | property |
numFiles:uint
[read-only]The number of items in the package.
Implementation public function get numFiles():uint
FurnaceFormat | () | constructor |
public function FurnaceFormat()
Creates a new FurnaceFormat object.
addFile | () | method |
public function addFile(file:ByteArray, name:String):uint
Adds a new file to the format.
Parametersfile:ByteArray — Contents of the file.
|
|
name:String — Name of the file.
|
uint — Index of the new file.
|
compressLibrary | () | method |
protected function compressLibrary():void
Compresses all objects that are in the library.
fileById | () | method |
public function fileById(index:uint):ByteArray
Returns the file at given item index.
Parametersindex:uint — The item index.
|
ByteArray — Content of the file.
|
— If index is out of bounds.
|
fileByName | () | method |
public function fileByName(fileName:String):ByteArray
Returns the file with given name. In order to find the file all items are searched for the given name and returns the first occurence. If no file is found an error will be thrown.
ParametersfileName:String — A filename.
|
ByteArray — Content of the file.
|
— If no file with given name exists.
|
fileName | () | method |
public function fileName(index:uint):String
Returns the filename at given index.
Parametersindex:uint — The index of the file.
|
String — Filename at given index.
|
— If index is out of bounds.
|
readExternal | () | method |
public function readExternal(input:IDataInput):void
Reads the furnace format from a given IDataInput
stream.
input:IDataInput — The stream to read from.
|
testBounds | () | method |
protected function testBounds(index:uint):void
Tests if an index is out of bounds.
Parametersindex:uint — Index to test.
|
— If index is out of bounds.
|
toString | () | method |
public function toString():String
Creates and returns a string representation of the object.
ReturnsString — The string representation of the object.
|
uncompressLibrary | () | method |
protected function uncompressLibrary():void
Uncompresses all objects that are in the library.
writeExternal | () | method |
public function writeExternal(output:IDataOutput):void
Writes the furnace format to a given IDataOutput
stream.
output:IDataOutput — The stream to write to.
|
VERSION | constant |
public static const VERSION:Number = 1.0
Actual version of the format.