Package org.jbox2d.serialization
Interface JbSerializer
- All Known Implementing Classes:
PbSerializer
public interface JbSerializer
Serializer for jbox2d, used to
serialize any aspect of the physics world
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Interface that allows the serializer to look up tags for each object, which can be used later during deserializing by the developer. -
Method Summary
Modifier and TypeMethodDescriptionSerializes a shapeSerializes a bodySerializes a fixtureserialize
(Joint joint, java.util.Map<Body, java.lang.Integer> bodyIndexMap, java.util.Map<Joint, java.lang.Integer> jointIndexMap) Serializes joints.Serializes the worldvoid
Sets the object signer for the serializer.void
setUnsupportedListener
(UnsupportedListener listener) Sets a listener for unsupported exception instead of stopping the whole serialization process by throwing and exception.
-
Method Details
-
setObjectSigner
Sets the object signer for the serializer. This allows the user to specify an 'tag' for each main physics object, which is then referenced later at deserialization for the user.- Parameters:
signer
-
-
setUnsupportedListener
Sets a listener for unsupported exception instead of stopping the whole serialization process by throwing and exception.- Parameters:
listener
-
-
serialize
Serializes the world- Parameters:
world
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
-
serialize
Serializes a body- Parameters:
body
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
-
serialize
Serializes a fixture- Parameters:
fixture
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
-
serialize
Serializes a shape- Parameters:
shape
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
-
serialize
SerializationResult serialize(Joint joint, java.util.Map<Body, java.lang.Integer> bodyIndexMap, java.util.Map<Joint, java.lang.Integer> jointIndexMap) Serializes joints. Joints need to reference bodies and sometimes other joints.- Parameters:
joint
-bodyIndexMap
-jointIndexMap
-- Returns:
-