com.Ostermiller.util.UberProperties.bte Maven / Gradle / Ivy
Go to download
Open source (GPL) Java utilities maintained by Stephen Ostermiller with help from many contributors.
The newest version!
<%bte.doc super="item.bte" %>
<%bte.tpl name=pageTitle%>Uber Properties<%/bte.tpl%>
<%bte.tpl name=description%>A replacement for the java.utils.Properties class with enhancements.<%/bte.tpl%>
<%bte.tpl name=keywords%>properties, java properties, uberproperties, uber properties, library for properties<%/bte.tpl%>
<%bte.tpl name=topcontent%>
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.
<%/bte.tpl%>
<%bte.tpl name=content%>
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);
<%/bte.tpl%>
<%bte.tpl name=linkUberProperties%>Uber Properties
<%/bte.tpl%>
<%/bte.doc%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy