|
A replacement for the java.utils.Properties class. This version can read and write properties files that are in the same format but it can handle multiple properties with the same name and makes comments from the files available. Example// create the properties UberProperties props = new UberProperties(); // File in which changes will be stored // relative to the users home directory String[] userFile = new String[]{ ".java","uberpropertiestest.properties" }; // This file must exist for this example to work // this file should contain default values. // In this case, it would be best to have the following line: // lastDate=This example was just run for the first time. String systemResource = "uberpropertiestest.properties"; // load the properties props.load(userFile, systemResource); // Display the date for the last time this example was run. System.out.println( props.getProperty("lastDate")); // set the date props.setProperty("lastDate", new Date().toString()); // resave the properties so the date will be printed next time props.save(userFile); |
OstermillerUtil Java Utilities Copyright (c) 2001-2020 by Stephen Ostermiller and other contributors
The OstermillerUtils library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
License FAQs - Why GPL? How about the LGPL or something else?