In this post we will go through the use of EDTA.
First, import it:
import htmlguy.edt.advanced.*;
Then, create the EDTAFile:
EDTAFile e = new EDTAFile();
Or, to immediately load from a file, add the location as a parameter:
EDTAFile e = new EDTAFile("MyEdtaFile.edta");
To modify a value, use modValue. However, with EDTA, the value parameter can be a String OR any primitive data type:
e.modValue("MyIntValue",123);
To get an EDTA value, use getValue.
EDTAValue v = e.getValue("MyIntValue");
BUT: With EDTA, this function returns an EDTAValue instead of a string.
To get the type of an EDTAValue, use getType.
ReturnType t = v.getType();
The ReturnType enum can be: STRING,INT,BOOL,FLOAT,DOUBLE,LONG,BYTE, OR OTHER.
Based on the type of ReturnType, you can figure out how to get the value:
if(t == ReturnType.INT)
{
int i = v.getIntValue();
}
else
{
System.err.println("The int Value is somehow not an int.");
}
The value "getters" are usually like this: getIntValue(), getStringValue(), getBoolValue(), etc.
To see a complete list of value "getters", download the javadoc from the "files" page.
To read from an EDTA file, use the readFrom function:
e.readFrom("MyEdtaFile.edta");
To write to an EDTA file, use the writeFile function:
e.writeFile("MyEdtaFile.edta");