|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.util.export.binary.BinaryExporter
public class BinaryExporter
Exports to the jME 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) FastMath.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.jme.math.Vector3f
"
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.jme.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 | |
---|---|
protected int |
aliasCount
|
static int |
COMPRESSION
|
protected java.util.IdentityHashMap<Savable,BinaryIdContentPair> |
contentTable
|
static boolean |
debug
|
protected int |
idCount
|
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> |
locationTable
|
Constructor Summary | |
---|---|
BinaryExporter()
|
Method Summary | |
---|---|
protected int |
findPrevMatch(BinaryIdContentPair oldPair,
java.util.ArrayList<BinaryIdContentPair> bucket)
|
protected byte[] |
fixClassAlias(byte[] bytes,
int width)
|
protected BinaryIdContentPair |
generateIdContentPair(BinaryClassObject bco)
|
protected byte[] |
generateTag()
|
BinaryOutputCapsule |
getCapsule(Savable object)
|
protected java.lang.String |
getChunk(BinaryIdContentPair pair)
|
static BinaryExporter |
getInstance()
|
int |
processBinarySavable(Savable object)
|
boolean |
save(Savable object,
java.io.File f)
|
boolean |
save(Savable object,
java.io.OutputStream os)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int COMPRESSION
protected int aliasCount
protected int idCount
protected java.util.IdentityHashMap<Savable,BinaryIdContentPair> contentTable
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> locationTable
public static boolean debug
Constructor Detail |
---|
public BinaryExporter()
Method Detail |
---|
public static BinaryExporter getInstance()
public boolean save(Savable object, java.io.OutputStream os) throws java.io.IOException
save
in interface JMEExporter
java.io.IOException
protected java.lang.String getChunk(BinaryIdContentPair pair)
protected int findPrevMatch(BinaryIdContentPair oldPair, java.util.ArrayList<BinaryIdContentPair> bucket)
protected byte[] fixClassAlias(byte[] bytes, int width)
public boolean save(Savable object, java.io.File f) throws java.io.IOException
save
in interface JMEExporter
java.io.IOException
public BinaryOutputCapsule getCapsule(Savable object)
getCapsule
in interface JMEExporter
public int processBinarySavable(Savable object) throws java.io.IOException
java.io.IOException
protected byte[] generateTag()
protected BinaryIdContentPair generateIdContentPair(BinaryClassObject bco)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |