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 Classes Modifier and Type Interface Description static interface
JbSerializer.ObjectSigner
Interface that allows the serializer to look up tags for each object, which can be used later during deserializing by the developer.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SerializationResult
serialize(Shape shape)
Serializes a shapeSerializationResult
serialize(Body body)
Serializes a bodySerializationResult
serialize(Fixture fixture)
Serializes a fixtureSerializationResult
serialize(Joint joint, java.util.Map<Body,java.lang.Integer> bodyIndexMap, java.util.Map<Joint,java.lang.Integer> jointIndexMap)
Serializes joints.SerializationResult
serialize(World world)
Serializes the worldvoid
setObjectSigner(JbSerializer.ObjectSigner signer)
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 Detail
-
setObjectSigner
void setObjectSigner(JbSerializer.ObjectSigner signer)
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
void setUnsupportedListener(UnsupportedListener listener)
Sets a listener for unsupported exception instead of stopping the whole serialization process by throwing and exception.- Parameters:
listener
-
-
serialize
SerializationResult serialize(World world) throws UnsupportedObjectException
Serializes the world- Parameters:
world
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
setUnsupportedListener(UnsupportedListener)
-
serialize
SerializationResult serialize(Body body) throws UnsupportedObjectException
Serializes a body- Parameters:
body
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
setUnsupportedListener(UnsupportedListener)
-
serialize
SerializationResult serialize(Fixture fixture) throws UnsupportedObjectException
Serializes a fixture- Parameters:
fixture
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
setUnsupportedListener(UnsupportedListener)
-
serialize
SerializationResult serialize(Shape shape) throws UnsupportedObjectException
Serializes a shape- Parameters:
shape
-- Returns:
- Throws:
UnsupportedObjectException
- if a physics object is unsupported by this library.- See Also:
setUnsupportedListener(UnsupportedListener)
-
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:
-
-