Package org.jbox2d.serialization
Interface JbSerializer
-
- All Known Implementing Classes:
PbSerializer
public interface JbSerializerSerializer for jbox2d, used to serialize any aspect of the physics world
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceJbSerializer.ObjectSignerInterface 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 SerializationResultserialize(Shape shape)Serializes a shapeSerializationResultserialize(Body body)Serializes a bodySerializationResultserialize(Fixture fixture)Serializes a fixtureSerializationResultserialize(Joint joint, java.util.Map<Body,java.lang.Integer> bodyIndexMap, java.util.Map<Joint,java.lang.Integer> jointIndexMap)Serializes joints.SerializationResultserialize(World world)Serializes the worldvoidsetObjectSigner(JbSerializer.ObjectSigner signer)Sets the object signer for the serializer.voidsetUnsupportedListener(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:
-
-