DataSerializer
Serialize and Deserialize data !
How to use an Serializer ?
First, create A FileSerializerBuilder object and invoke "get" method to return the FileSerializer:
Example:
// Create first an builder with the compilation type and cast it
JsonFileSerializer serializer = (JsonFileSerializer) new FileSerializerBuilder().type(CompilationType.JSON).get();
// write your data, Warning: the json serializer need keys !
serializer.writeObject("int", 192);
serializer.writeObject("string", "test");
serializer.writeObject("float", 42.5f);
// and for creating the file, juste call "compile"
// method with the target file
long execTime = serializer.compile(new File("data")); // You can get the time of the building task
// Don't forget to close the serializer !
serializer.close();How to use an Deserializer ?
First, create A FileDeserializerBuilder object and invoke "get" method to return the FileSerializer:
Example:
// Create first an builder with the compilation type and the file and cast it
JsonFileDeserializer deserializer = (JsonFileDeserializer) new FileDeserializerBuilder().type(CompilationType.JSON).file(new File("data")).get();
// read your data, the Deserializer has DataInputStream as superclass, Warning: the json deserializer need keys !
int resultInt = deserializer.readInt("int");
String resultString = deserializer.readUTF("string");
float resultFloat = deserializer.readFloat("float");
// Don't forget to close the deserializer !
serializer.close();Tip: You can use a "try-catch-with-ressources" instead calling close method.
Installation
Lastest Version: download
Maven Integration
Be sure to replace the VERSION key below with the latest version !
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<dependency>
<groupId>com.github.sofianelecubeur</groupId>
<artifactId>DataSerializer</artifactId>
<version>VERSION</version>
</dependency>Documentation
Find the JavaDoc here: javadoc

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
