binary-data-format/bdf/Main.java

34 lines
833 B
Java
Raw Normal View History

2019-07-07 18:14:47 +10:00
package bdf;
2019-07-07 19:26:18 +10:00
import bdf.file.BdfFileManager;
2019-07-07 18:14:47 +10:00
import bdf.types.BdfArray;
2019-07-07 19:49:59 +10:00
import bdf.types.BdfNamedList;
2019-07-07 18:14:47 +10:00
import bdf.types.BdfObject;
public class Main {
public static void main(String[] args)
{
2019-07-07 19:49:59 +10:00
BdfFileManager bdf = new BdfFileManager("db/file.db");
2019-07-07 18:14:47 +10:00
2019-07-07 19:49:59 +10:00
BdfNamedList bdf_nl = new BdfNamedList();
bdf_nl.set("greeting", BdfObject.getNew("Hello, World!"));
bdf_nl.set("integer", BdfObject.getNew(21));
bdf_nl.set("integer", BdfObject.getNew(52));
2019-07-07 18:14:47 +10:00
2019-07-07 19:49:59 +10:00
BdfArray bdf_array = new BdfArray();
bdf_array.add(BdfObject.getNew(61));
bdf_array.add(BdfObject.getNew(42.0d));
bdf_array.add(BdfObject.getNew(67F));
bdf_array.add(BdfObject.getNew("hello!"));
2019-07-07 18:14:47 +10:00
2019-07-07 19:49:59 +10:00
bdf_nl.set("array", BdfObject.getNew(bdf_array));
bdf.setNamedList(bdf_nl);
2019-07-07 18:14:47 +10:00
2019-07-07 19:49:59 +10:00
bdf.saveDatabase();
2019-07-07 19:26:18 +10:00
2019-07-07 19:49:59 +10:00
System.out.println(bdf.serializeHumanReadable());
2019-07-07 18:14:47 +10:00
}
}