Recently, I had to add this feature to some software, so I thought I'd quickly review the process for those who missed it the first time. Many years ago I covered how to read and write properties files in Java. Recently, I had to add this feature to some software, so I thought I'd quickly review the process for those who missed it the first time. We all know the motivation behind configuration, or properties, files — it's bad practice to hard-code values into your code,
File f = new File("server.properties");
OutputStream out = new FileOutputStream( f );
props.store(out, "This is an optional header comment string");
File f = new File("server.xml");
OutputStream out = new FileOutputStream( f );
props.storeToXML(out, "This is an optional header comment string");
Read full article from Read/Write Properties Files in Java | Dr Dobb's
File f = new File("server.properties");
OutputStream out = new FileOutputStream( f );
props.store(out, "This is an optional header comment string");
File f = new File("server.xml");
OutputStream out = new FileOutputStream( f );
props.storeToXML(out, "This is an optional header comment string");
Read full article from Read/Write Properties Files in Java | Dr Dobb's
No comments:
Post a Comment