Changes between Initial Version and Version 1 of properties


Ignore:
Timestamp:
Aug 7, 2010 8:13:22 PM (9 years ago)
Author:
dream
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • properties

    v1 v1  
     1Properties 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.
     2
     3So like,
     4{{{
     5class ClientThingy {
     6    public final static File PROPERTY_FILE = new File(I2PAppContext.getGlobalContext().getConfigDir(),"clientThingy.config");
     7
     8    Properties properties;
     9
     10    ClientThingy() {
     11        properties = new Properties();
     12        properties.load(new FileInputStream(PROPERTY_FILE));
     13    }
     14
     15    void save(void) {
     16        properties.store(new FileOutputStream(PROPERTY_FILE),"clientThingy");
     17    }
     18}
     19}}}