Bagikan melalui


Properties.Store Method

Definition

Overloads

Store(Writer, String)

Writes this property list (key and element pairs) in this Properties table to the output character stream in a format suitable for using the #load(java.io.Reader) load(Reader) method.

Store(Stream, String)

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

Store(Writer, String)

Writes this property list (key and element pairs) in this Properties table to the output character stream in a format suitable for using the #load(java.io.Reader) load(Reader) method.

[Android.Runtime.Register("store", "(Ljava/io/Writer;Ljava/lang/String;)V", "GetStore_Ljava_io_Writer_Ljava_lang_String_Handler")]
public virtual void Store (Java.IO.Writer? writer, string? comments);
[<Android.Runtime.Register("store", "(Ljava/io/Writer;Ljava/lang/String;)V", "GetStore_Ljava_io_Writer_Ljava_lang_String_Handler")>]
abstract member Store : Java.IO.Writer * string -> unit
override this.Store : Java.IO.Writer * string -> unit

Parameters

writer
Writer

an output character stream writer.

comments
String

a description of the property list.

Attributes

Exceptions

if a key or value is not a string

Remarks

Writes this property list (key and element pairs) in this Properties table to the output character stream in a format suitable for using the #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.

Added in 1.6.

Java documentation for java.util.Properties.store(java.io.Writer, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Store(Stream, String)

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

[Android.Runtime.Register("store", "(Ljava/io/OutputStream;Ljava/lang/String;)V", "GetStore_Ljava_io_OutputStream_Ljava_lang_String_Handler")]
public virtual void Store (System.IO.Stream? out, string? comments);
[<Android.Runtime.Register("store", "(Ljava/io/OutputStream;Ljava/lang/String;)V", "GetStore_Ljava_io_OutputStream_Ljava_lang_String_Handler")>]
abstract member Store : System.IO.Stream * string -> unit
override this.Store : System.IO.Stream * string -> unit

Parameters

out
Stream

an output stream.

comments
String

a description of the property list.

Attributes

Exceptions

if a key or value is not a string

Remarks

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

Properties from the defaults table of this Properties table (if any) are not written out by this method.

This method outputs the comments, properties keys and values in the same format as specified in #store(java.io.Writer, java.lang.String) store(Writer), with the following differences: <ul> <li>The stream is written using the ISO 8859-1 character encoding.

<li>Characters not in Latin-1 in the comments are written as \u005Cuxxxx for their appropriate unicode hexadecimal value xxxx.

<li>Characters less than \u005Cu0020 and characters greater than \u005Cu007E in property keys or values are written as \u005Cuxxxx for the appropriate hexadecimal value xxxx. </ul>

After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.

Added in 1.2.

Java documentation for java.util.Properties.store(java.io.OutputStream, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to