📄 properties.html
字号:
<pre>"apple, banana, pear, cantaloupe, watermelon,kiwi, mango"</pre> Note that a space appears before each <code>\</code> so that a space will appear after each comma in the final result; the <code>\</code>, line terminator, and leading whitespace on the continuation line are merely discarded and are <i>not</i> replaced by one or more other characters. <p> As a third example, the line: <p> <pre>cheeses </pre> specifies that the key is <code>"cheeses"</code> and the associated element is the empty string.<p><DD><DL><DT><B>Parameters:</B><DD><CODE>inStream</CODE> - the input stream.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an error occurred when reading from the input stream.</DL></DD></DL><HR><A NAME="save(java.io.OutputStream, java.lang.String)"><!-- --></A><H3>save</H3><PRE>public void <B>save</B>(<A HREF="../../java/io/OutputStream.html">OutputStream</A> out, <A HREF="../../java/lang/String.html">String</A> header)</PRE><DL><DD><B>Deprecated.</B> <I>This method does not throw an IOException if an I/O error occurs while saving the property list. As of the Java 2 platform v1.2, the preferred way to save a properties list is via the <code>store(OutputStream out, String header)</code> method.</I><P><DD>Calls the <code>store(OutputStream out, String header)</code> method and suppresses IOExceptions that were thrown.<DD><DL><DT><B>Parameters:</B><DD><CODE>out</CODE> - an output stream.<DD><CODE>header</CODE> - a description of the property list.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if this <code>Properties</code> object contains any keys or values that are not <code>Strings</code>.</DL></DD></DL><HR><A NAME="store(java.io.OutputStream, java.lang.String)"><!-- --></A><H3>store</H3><PRE>public void <B>store</B>(<A HREF="../../java/io/OutputStream.html">OutputStream</A> out, <A HREF="../../java/lang/String.html">String</A> header) throws <A HREF="../../java/io/IOException.html">IOException</A></PRE><DL><DD>Writes this property list (key and element pairs) in this <code>Properties</code> table to the output stream in a format suitable for loading into a <code>Properties</code> table using the <code>load</code> method. The stream is written using the ISO 8859-1 character encoding. <p> Properties from the defaults table of this <code>Properties</code> table (if any) are <i>not</i> written out by this method. <p> If the header argument is not null, then an ASCII <code>#</code> character, the header string, and a line separator are first written to the output stream. Thus, the <code>header</code> can serve as an identifying comment. <p> Next, a comment line is always written, consisting of an ASCII <code>#</code> character, the current date and time (as if produced by the <code>toString</code> method of <code>Date</code> for the current time), and a line separator as generated by the Writer. <p> Then every entry in this <code>Properties</code> table is written out, one per line. For each entry the key string is written, then an ASCII <code>=</code>, then the associated element string. Each character of the element string is examined to see whether it should be rendered as an escape sequence. The ASCII characters <code>\</code>, tab, newline, and carriage return are written as <code>\\</code>, <code>\t</code>, <code>\n</code>, and <code>\r</code>, respectively. Characters less than <code>\u0020</code> and characters greater than <code>\u007E</code> are written as <code>\u</code><i>xxxx</i> for the appropriate hexadecimal value <i>xxxx</i>. Leading space characters, but not embedded or trailing space characters, are written with a preceding <code>\</code>. The key and value characters <code>#</code>, <code>!</code>, <code>=</code>, and <code>:</code> are written with a preceding slash to ensure that they are properly loaded. <p> After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.<DD><DL><DT><B>Parameters:</B><DD><CODE>out</CODE> - an output stream.<DD><CODE>header</CODE> - a description of the property list.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if writing this property list to the specified output stream throws an <tt>IOException</tt>.<DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if this <code>Properties</code> object contains any keys or values that are not <code>Strings</code>.</DL></DD></DL><HR><A NAME="getProperty(java.lang.String)"><!-- --></A><H3>getProperty</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getProperty</B>(<A HREF="../../java/lang/String.html">String</A> key)</PRE><DL><DD>Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns <code>null</code> if the property is not found.<DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the property key.<DT><B>Returns:</B><DD>the value in this property list with the specified key value.<DT><B>See Also: </B><DD><A HREF="../../java/util/Properties.html#setProperty(java.lang.String, java.lang.String)"><CODE>setProperty(java.lang.String, java.lang.String)</CODE></A>, <A HREF="../../java/util/Properties.html#defaults"><CODE>defaults</CODE></A></DL></DD></DL><HR><A NAME="getProperty(java.lang.String, java.lang.String)"><!-- --></A><H3>getProperty</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getProperty</B>(<A HREF="../../java/lang/String.html">String</A> key, <A HREF="../../java/lang/String.html">String</A> defaultValue)</PRE><DL><DD>Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.<DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the hashtable key.<DD><CODE>defaultValue</CODE> - a default value.<DT><B>Returns:</B><DD>the value in this property list with the specified key value.<DT><B>See Also: </B><DD><A HREF="../../java/util/Properties.html#setProperty(java.lang.String, java.lang.String)"><CODE>setProperty(java.lang.String, java.lang.String)</CODE></A>, <A HREF="../../java/util/Properties.html#defaults"><CODE>defaults</CODE></A></DL></DD></DL><HR><A NAME="propertyNames()"><!-- --></A><H3>propertyNames</H3><PRE>public <A HREF="../../java/util/Enumeration.html">Enumeration</A> <B>propertyNames</B>()</PRE><DL><DD>Returns an enumeration of all the keys in this property list, including the keys in the default property list.<DD><DL><DT><B>Returns:</B><DD>an enumeration of all the keys in this property list, including the keys in the default property list.<DT><B>See Also: </B><DD><A HREF="../../java/util/Enumeration.html"><CODE>Enumeration</CODE></A>, <A HREF="../../java/util/Properties.html#defaults"><CODE>defaults</CODE></A></DL></DD></DL><HR><A NAME="list(java.io.PrintStream)"><!-- --></A><H3>list</H3><PRE>public void <B>list</B>(<A HREF="../../java/io/PrintStream.html">PrintStream</A> out)</PRE><DL><DD>Prints this property list out to the specified output stream. This method is useful for debugging.<DD><DL><DT><B>Parameters:</B><DD><CODE>out</CODE> - an output stream.</DL></DD></DL><HR><A NAME="list(java.io.PrintWriter)"><!-- --></A><H3>list</H3><PRE>public void <B>list</B>(<A HREF="../../java/io/PrintWriter.html">PrintWriter</A> out)</PRE><DL><DD>Prints this property list out to the specified output stream. This method is useful for debugging.<DD><DL><DT><B>Parameters:</B><DD><CODE>out</CODE> - an output stream.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Properties.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/util/Observable.html"><B>PREV CLASS</B></A> <A HREF="../../java/util/PropertyPermission.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Properties.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -