-
Persisting Properties object using store()
I have the following code to [try to] persist my Properties object to a file.
However, all that is written is the 2 comment lines - no key/value pairs.
I am using in the context of a simple command line app, so I do not think
SecurityManger is coming into play. The "list" command does successfully
list the Property object's contents.
Any help appreciated!
<pre>
Code follows (hopefully legible)
FileOutputStream objFileOut = null;
try
{
objFileOut = new FileOutputStream(m_objAppFile);
// Load non-default properties
if(objFileOut != null)
{
m_objAppProperties.list(System.out);
m_objAppProperties.store(objFileOut, "Wood Programming Services");
}
}
catch(FileNotFoundException fnfe)
{
// Thrown by FileInputStream()
System.err.println(strMethodName + fnfe.getMessage());
System.err.println("\tFailed to save logger properties file.");
}
catch(IOException ioe)
{
// Thrown by load()
System.err.println(strMethodName + ioe.getMessage());
System.err.println("\tFailed to save logger properties file.");
}
finally
{
try
{
if(objFileOut != null)
{
objFileOut.close();
}
}
catch(IOException ioe)
{
System.err.println(strMethodName + ioe.getMessage());
}
}
===============
screen output
===============
-- listing properties --
DEBUG_LOG_KEY=false
ERROR_LOG_KEY=false
EVENT_LOG_KEY=wpsEvent.log
Press any key to continue...
===============
file output
===============
#Wood Programming Services
#Fri Feb 08 18:24:33 EST 2002
</pre>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks