Class BinaryExporter

java.lang.Object
com.ardor3d.util.export.binary.BinaryExporter
All Implemented Interfaces:
Ardor3dExporter

public class BinaryExporter extends Object implements Ardor3dExporter
Exports to the ardor3d Binary Format. Format descriptor: (each numbered item denotes a series of bytes that follows sequentially one after the next.)

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 Details

    • DEFAULT_COMPRESSION

      public static int DEFAULT_COMPRESSION
      The 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

      protected final Map<Savable,BinaryIdContentPair> _contentTable
    • _locationTable

      protected final Map<Integer,Integer> _locationTable
    • _classes

      protected final Map<String,BinaryClassObject> _classes
    • _contentKeys

      protected final List<Savable> _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 from Deflater
  • Method Details