This is a Java library for the VDF file format.
Using this library, it's possible to read, create and edit VDF files, both in textual or binary format.
Let's say we have a file: data.vdf
(textual VDF)
{
boolean "isRaining": false,
byte "temperature": 70,
float "PI": 3.14,
byte[] "favourite_bytes": [
0, -127, 128
]
}
First of all, we should read the VDF object written in that file.
VDFObject obj = new VDFObject();
try(Reader reader = new FileReader("./data.vdf")) {
obj.parse(reader);
}
Now that we have the object, we can get a value.
boolean isRaining = obj.getBoolean("isRaining");
If we want to add a new value, it's not harder than getting one.
obj.setString("name", "John");
VDF is very similar to JSON, but it supports types. Also, this library
can be used to generate Binary VDF files.
This library is perfect for programmers who need to store both small and
large amounts of data in an efficient and easy way.
The format supports all Java types, arrays of them and two data
structures, object
and list
.
Both formats have their advantages. Binary VDF files are smaller and
faster to read/write, while textual VDF files are human readable.
VDF specification (both binary and textual formats) can be found in the 'doc' folder.