Class BinaryExporter
- All Implemented Interfaces:
- JmeExporter
Format description: (Each numbered item describes a series of bytes that follow sequentially, one after the other.)
1. "signature" - 4 bytes - 0x4A4D4533
2. "version" - 4 bytes - 0x00000002
3. "number of classes" - 4 bytes - number of entries in the class table
CLASS TABLE: X blocks, each consisting of items 4 thru 11, where X = the number of Savable classes from item 3
4. "class alias" - X bytes, where X = ((int) FastMath.log(aliasCount, 256) + 1) - a numeric ID used to refer to a Savable class when reading or writing
5. "full class-name size" - 4 bytes - the number of bytes in item 6
6. "full class name" - X bytes of text, where X = the size from item 5
 - the fully qualified class name of the Savable class,
 e.g. "com.jme.math.Vector3f"
 
7. "number of fields" - 4 bytes - the number of saved fields in the Savable class
8. "field alias" - 1 byte - a numeric ID used to refer to a saved field when reading or writing. Because field aliases are only a single byte, no Savable class can save more than 256 fields.
9. "field type" - 1 byte
 - the type of data in the saved field. Values are defined in
 com.jme.util.export.binary.BinaryClassField.
 
10. "field-name size" - 4 bytes - the number of bytes in item 11
11. "field name" - X bytes of text, where X = the size from item 10 - the tag specified when reading or writing the saved field
12. "number of capsules" - 4 bytes - the number of capsules in this stream
LOCATION TABLE: X blocks, each consisting of items 13 and 14, where X = the number of capsules from item 12
13. "data id" - 4 bytes - numeric ID of an object that was saved to this stream
14. "data location" - 4 bytes - the offset in the capsule-data section where the savable object identified in item 13 is stored
15. "future use" - 4 bytes - 0x00000001
16. "root id" - 4 bytes - numeric ID of the top-level savable object CAPSULE-DATA SECTION: X blocks, each consisting of items 17 thru 19, where X = the number of capsules from item 12
17. "class alias" - 4 bytes - see item 4
18. "capsule length" - 4 bytes - the length in bytes of item 19
19. "capsule data" - X bytes of data, where X = the number of bytes from item 18
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intstatic booleanprotected intstatic boolean
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected byte[]fixClassAlias(byte[] bytes, int width) protected byte[]getCapsule(Savable object) Returns theOutputCapsulefor the given savable object.static BinaryExporterintprocessBinarySavable(Savable object) voidExport theSavableto a file.voidsave(Savable object, OutputStream os) Export theSavableto an OutputStream.static <T extends Savable>
 TsaveAndLoad(AssetManager assetManager, T object) Saves the object into memory then loads it from memory.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jme3.export.JmeExportersave
- 
Field Details- 
aliasCountprotected int aliasCount
- 
idCountprotected int idCount
- 
locationTable
- 
debugpublic static boolean debug
- 
useFastBufspublic static boolean useFastBufs
 
- 
- 
Constructor Details- 
BinaryExporterpublic BinaryExporter()
 
- 
- 
Method Details- 
getInstance
- 
saveAndLoadSaves the object into memory then loads it from memory. Used by tests to check if the persistence system is working.- Type Parameters:
- T- The type of savable.
- Parameters:
- assetManager- AssetManager to load assets from.
- object- The object to save and then load.
- Returns:
- A new instance that has been saved and loaded from the original object.
 
- 
saveDescription copied from interface:JmeExporterExport theSavableto an OutputStream.- Specified by:
- savein interface- JmeExporter
- Parameters:
- object- The savable to export
- os- The output stream
- Throws:
- IOException- If an io exception occurs during export
 
- 
fixClassAliasprotected byte[] fixClassAlias(byte[] bytes, int width) 
- 
saveDescription copied from interface:JmeExporterExport theSavableto a file. If the path to the file doesn't exist, the parent directories can be created if thecreateDirectoriesflag is true. If the path does not exist andcreateDirectoriesis false, then an exception is thrown.- Specified by:
- savein interface- JmeExporter
- Parameters:
- object- The savable to export
- f- The file to export to
- createDirectories- flag to indicate if the directories should be created
- Throws:
- IOException- If an io exception occurs during export
 
- 
getCapsuleDescription copied from interface:JmeExporterReturns theOutputCapsulefor the given savable object.- Specified by:
- getCapsulein interface- JmeExporter
- Parameters:
- object- The object to retrieve an output capsule for.
- Returns:
- the OutputCapsulefor the given savable object.
 
- 
processBinarySavable- Throws:
- IOException
 
- 
generateTagprotected byte[] generateTag()
 
-