Poet is a file management and serialization tool written in Java. Poet aims to ease the process of serializing files and managing directories and their content.
To install Poet through Maven, you will need to add the JitPack repository to your pom.xml
file:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Next, you need to add Poet as a dependency:
<dependency>
<groupId>com.github.limbo56</groupId>
<artifactId>Poet</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
Java 8 is the minimum version required to use this tool
That's it for the installation 🎉
This project is a library aimed at easing the process of file handling in Java. In the next section, I'm going to be showcasing some of the features of this library.
The Deserializer
class is useful when you want a file to be serialized into a certain object type.
To add a deserializer, you must call the Deserializer#addDeserializer
. For example, lets say we want to add a deserializer that transforms files into a JsonObject
.
To achieve this, we need to add a deserializer as follows:
Deserializer.addDeserializer(
JsonObject.class,
file -> JsonParser.parseReader(new FileReader(file)).getAsJsonObject()
);
After that, to deserialize the file, we would call the Deserializer#deserializeFile
method:
JsonObject object = Deserializer.deserializeFile(file, JsonObject.class);
The Directory
class is aimed to ease the handling of directories. It contains a variety of methods useful for handling the files in a directory.
You can bundle multiple directories using the DirectoryBundle
class. This class helps when you want to access common files in multiple directories. For example, this would be useful for localization.
This project is licensed under the MIT
license.
Make sure you read the license before using this library.