Package org.gittorr.ccerial
Class Ccerial
java.lang.Object
org.gittorr.ccerial.Ccerial
The
Ccerial class is the main entry point for the Ccerial serialization framework.
This utility provides methods to obtain serializers for classes annotated with CcSerializable.
Usage:
// Example of obtaining a serializer and serializing an object
User user = new User();
user.setName("John");
user.setAge(30);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Ccerial.getSerializer(User.class).serialize(user, outputStream);
byte[] serializedData = outputStream.toByteArray();
ByteArrayInputStream inputStream = new ByteArrayInputStream(serializedData);
User deserializedUser = Ccerial.getSerializer(User.class).deserialize(inputStream);
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> Serializer<E>getSerializer(Class<E> forClass) Retrieves the serializer for the specified class.
-
Constructor Details
-
Ccerial
public Ccerial()
-
-
Method Details
-
getSerializer
Retrieves the serializer for the specified class. Classes must be annotated withCcSerializableto have serializers generated.- Type Parameters:
E- the type of the class being serialized- Parameters:
forClass- the class to retrieve the serializer for- Returns:
- the
Serializerinstance for the specified class - Throws:
IllegalArgumentException- if no serializer is found for the class
-