Writes this property list (key and element pairs) in this
Properties table to the output character stream in a format suitable for using the {@link #load(java.io.Reader) load(Reader)}method.
Properties from the defaults table of this Properties table (if any) are not written out by this method.
If the comments argument is not null, then an ASCII # character, the comments string, and a line separator are first written to the output stream. Thus, the comments can serve as an identifying comment. Any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a line feed in comments is replaced by a line separator generated by the Writer and if the next character in comments is not character # or character ! then an ASCII # is written out after that line separator.
Next, a comment line is always written, consisting of an ASCII # character, the current date and time (as if produced by the toString method of Date for the current time), and a line separator as generated by the Writer.
Then every entry in this Properties table is written out, one per line. For each entry the key string is written, then an ASCII =, then the associated element string. For the key, all space characters are written with a preceding \ character. For the element, leading space characters, but not embedded or trailing space characters, are written with a preceding \ character. The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded.
After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.
@param writer an output character stream writer.
@param comments a description of the property list.
@exception IOException if writing this property list to the specifiedoutput stream throws an IOException.
@exception ClassCastException if this Properties objectcontains any keys or values that are not Strings.
@exception NullPointerException if writer is null.
@since 1.6