Class BinaryExporter
- All Implemented Interfaces:
Ardor3dExporter
1. "number of classes" - four bytes - int value representing the number of entries in the class lookup table.
CLASS TABLE: There will be X blocks each consisting of numbers 2 thru 9, where X = the number read in 1.
2. "class alias" - 1...X bytes, where X = ((int) MathUtils.log(aliasCount, 256) + 1) - an alias used when writing object data to match an object to its appropriate object class type.
3. "full class name size" - four bytes - int value representing number of bytes to read in for next field.
4. "full class name" - 1...X bytes representing a String value, where X = the number read in 3. The String is the
fully qualified class name of the Savable class, eg "com.ardor3d.math.Vector3
"
5. "number of fields" - four bytes - int value representing number of blocks to read in next (numbers 6 - 9), where each block represents a field in this class.
6. "field alias" - 1 byte - the alias used when writing out fields in a class. Because it is a single byte, a single class can not save out more than a total of 256 fields.
7. "field type" - 1 byte - a value representing the type of data a field contains. This value is taken from the
static fields of com.ardor3d.util.export.binary.BinaryClassField
.
8. "field name size" - 4 bytes - int value representing the size of the next field.
9. "field name" - 1...X bytes representing a String value, where X = the number read in 8. The String is the full String value used when writing the current field.
10. "number of unique objects" - four bytes - int value representing the number of data entries in this file.
DATA LOOKUP TABLE: There will be X blocks each consisting of numbers 11 and 12, where X = the number read in 10.
11. "data id" - four bytes - int value identifying a single unique object that was saved in this data file.
12. "data location" - four bytes - int value representing the offset in the object data portion of this file where the object identified in 11 is located.
13. "future use" - four bytes - hardcoded int value 1.
14. "root id" - four bytes - int value identifying the top level object.
OBJECT DATA SECTION: There will be X blocks each consisting of numbers 15 thru 19, where X = the number of unique location values named in 12.
15. "class alias" - see 2.
16. "data length" - four bytes - int value representing the length in bytes of data stored in fields 17 and 18 for this object.
FIELD ENTRY: There will be X blocks each consisting of numbers 18 and 19
17. "field alias" - see 6.
18. "field data" - 1...X bytes representing the field data. The data length is dependent on the field type and contents.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected final Map
<String, BinaryClassObject> protected final int
protected final Map
<Savable, BinaryIdContentPair> protected int
static int
The default compression level to use during output. -
Constructor Summary
ConstructorDescriptionBinaryExporter
(int compression) Construct a new exporter, specifying some options. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
findPrevMatch
(BinaryIdContentPair oldPair, List<BinaryIdContentPair> bucket) protected byte[]
fixClassAlias
(byte[] bytes, int width) protected BinaryIdContentPair
protected byte[]
protected String
getChunk
(BinaryIdContentPair pair) int
processBinarySavable
(Savable object) void
Save a Savable object to the given file.void
save
(Savable object, OutputStream os) Save a Savable object to the given stream.
-
Field Details
-
DEFAULT_COMPRESSION
public static int DEFAULT_COMPRESSIONThe default compression level to use during output. Defaults to Deflater.BEST_COMPRESSION. -
_compression
protected final int _compression -
_aliasCount
protected int _aliasCount -
_idCount
protected int _idCount -
_contentTable
-
_locationTable
-
_classes
-
_contentKeys
-
-
Constructor Details
-
BinaryExporter
public BinaryExporter() -
BinaryExporter
public BinaryExporter(int compression) Construct a new exporter, specifying some options.- Parameters:
compression
- the compression type to use. One of the constants fromDeflater
-
-
Method Details
-
save
Description copied from interface:Ardor3dExporter
Save a Savable object to the given stream.- Specified by:
save
in interfaceArdor3dExporter
- Parameters:
object
- the savable objectos
- the output stream- Throws:
IOException
- exception
-
getChunk
-
findPrevMatch
-
fixClassAlias
protected byte[] fixClassAlias(byte[] bytes, int width) -
save
Description copied from interface:Ardor3dExporter
Save a Savable object to the given file.- Specified by:
save
in interfaceArdor3dExporter
- Parameters:
object
- the savable objectfile
- the file- Throws:
IOException
- exception
-
processBinarySavable
- Throws:
IOException
-
generateTag
protected byte[] generateTag() -
generateIdContentPair
-