A Java API for easy to read data serialization
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


DataAPI is a Java API for easy to read data serialization. DataAPI was written by Skionz to allow easy configuration and a way to allow users to easily change the properties of programs.


- Increased speed by 800% - Created a format exception - Added the MapFile class


DataAPI consists of two main classes, DataFile, and ListFile. DataFile stores data in a key: value format while ListFile stores String lists line by line.


When declaring a new instance of the DataFile class the constructor creates a new file if the file does not already exists. Here is some example usage:
DataFile file = new DataFile("data", "txt");
file.set("key1", "value");
file.set("key2", 53);
file.set("key3", true);
Will create or load an already existing file named data.txt and would look like this:
key1: value
key2: 53
key3: true

You can also get data from a file using the get methods. Here is an example:

DataFile file = new DataFile("data", "txt");
int value = file.getInt("key2");
System.out.println("The returned value is: " + value);

This would output 53. If the key is not found the method will return null.


The ListFile class is very simple and writes to a file line by line from a String ArrayList. Here is some example usage:
ListFile file = new ListFile("list", "txt");
ArrayList list = new ArrayList();
list.add("This is line number one");
list.add("This is line number two");

The output of this would look like:

This is line number one
This is line number two

You can also turn a file into an ArrayList by using the read method as shown here:

ListFile file = new ListFile("list", "txt");
ArrayList list = file.read();
for(String line : list) {

Would print the following in the console:

This is line number one
This is line number two


The MapFile class is a simple wrapper class that allows for quick and ledgible Map serilization. The MapFile class is simple and like the ListFile class it only consists of 5 methods. Here is some example usage:
MapFile file = new MapFile("Map", "txt");
HashMap map = new HashMap();
map.put("Key 1", "This is a string value");
map.put("Key 2", 71);
map.put("Key 3", false);

A file would be created named Map.txt and would look similar to the following.

Key 1: This is a string value
Key 2: 71
Key 3: false


DataUtils is a utility class. Data contains static methods used for classic serialization and deserialization. You can use them like this:
Data.serialize("This is a string object", "object", "ser");
System.out.println(Data.deserialize("object", "ser"));
//will print "This is a string object" in the console

Classes and Methods

Here is a list of all of the classes and their methods.


- clear() - delete() - getBoolean() - getByte() - getDouble() - getFloat() - getInt() - getList() - getLong() - getShort() - getString() - isBoolean() - isByte() - isDouble() - isFloat() - isInt() - isLong() - isShort() - keyList() - remove() - save() - set(String, String) - valueList()


- addLine(String) - clear() - delete() - write() - read(ArrayList<String>)


- clear() - delete() - put(String, String) - write() - read(Map<String, String>)


- createDataFile(String, String) - createListFile(String, String) - createMapFile(String, String) - deserialize(String, String) - fileExists(String, String) - serialize(Object, String, String)