mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
838 B
Java
40 lines
838 B
Java
3 years ago
|
package network.loki.lokinet;
|
||
|
|
||
|
import java.nio.ByteBuffer;
|
||
|
|
||
|
public class LokinetConfig
|
||
|
{
|
||
|
static {
|
||
|
System.loadLibrary("lokinet-android");
|
||
|
}
|
||
|
|
||
|
private static native ByteBuffer Obtain(String dataDir);
|
||
|
private static native void Free(ByteBuffer buf);
|
||
|
|
||
|
/*** load config file from disk */
|
||
|
public native boolean Load();
|
||
|
/*** save chages to disk */
|
||
|
public native boolean Save();
|
||
|
|
||
|
|
||
|
/** override default config value before loading from config file */
|
||
|
public native void AddDefaultValue(String section, String key, String value);
|
||
|
|
||
|
private final ByteBuffer impl;
|
||
|
|
||
|
public LokinetConfig(String dataDir)
|
||
|
{
|
||
|
impl = Obtain(dataDir);
|
||
|
if(impl == null)
|
||
|
throw new RuntimeException("cannot obtain config from "+dataDir);
|
||
|
}
|
||
|
|
||
|
public void finalize()
|
||
|
{
|
||
|
if (impl != null)
|
||
|
{
|
||
|
Free(impl);
|
||
|
}
|
||
|
}
|
||
|
}
|