wiki:properties

Properties in i2p can be accessed from the I2PAppContext, but the RouterContext? is what loads and saves them. I'm not sure how i2cp client applications would get access to a RouterContext? without running a router themselves, but maybe they could load one up that only did configuration. Or maybe some intelligent fellow will separate the Internet router with the configuration properties. But for now you should just make your own property file in your plugin directory or somewhere in $USER, and just make sure the class that uses it loads and saves the property file in the right places.

So like,

class ClientThingy {
    public final static File PROPERTY_FILE = new File(I2PAppContext.getGlobalContext().getConfigDir(),"clientThingy.config");

    Properties properties;

    ClientThingy() {
        properties = new Properties();
        properties.load(new FileInputStream(PROPERTY_FILE));
    }

    void save(void) {
        properties.store(new FileOutputStream(PROPERTY_FILE),"clientThingy");
    }
}
Last modified 10 years ago Last modified on Aug 7, 2010 8:13:22 PM