* Results are sorted by property name.
*/
public static void print( String fileName, Properties props ) throws IOException {
FileOutputStream stream = null;
PrintStream writer = null;
try {
stream = new FileOutputStream(fileName);
writer = new PrintStream(stream);
List names = new ArrayList();
Enumeration enumeration = props.propertyNames();
while ( enumeration.hasMoreElements() ) {
String name = (String) enumeration.nextElement();
names.add(name);
}
Collections.sort(names);
StringBuffer sb;
for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
String name = (String) nIt.next();
String value = props.getProperty(name);
sb = new StringBuffer();
sb.append(name);
sb.append("="); //$NON-NLS-1$
sb.append(value);
writer.println(sb.toString());
}
writer.flush();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (Exception e){
}
try {