?? readpropresource.html
字號:
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Code Samples from the Java Developers Almanac 1.4
</TITLE>
<META CONTENT="Author's Name Goes Here" NAME="AUTHOR">
<META CONTENT="Description Goes Here" NAME="DESCRIPTION">
<META CONTENT="Keyword Listing Goes Here" NAME="KEYWORDS">
<META CONTENT="Editorial/JDC" NAME="OWNER">
<META CONTENT="@(#)index2.src 1.2 06/09/99 JDC" NAME="revision">
<STYLE TYPE="text/css">
<!-- CODE {font-family: Courier, Monospace; font-size: 12pt} PRE {font-family: Courier, Monospace; font-size: 11pt} BODY {font-size: 10pt} -->
</STYLE>
</HEAD>
<BODY>
<TR>
<TD></TD>
</TR>
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR>
<TD><FONT FACE="Verdana, Arial, Helvetica, sans-serif">
<DIV ALIGN="RIGHT">
<FONT SIZE="3"><B>java.util</B></FONT>
<BR>
<FONT SIZE="-1"><A HREF="../index.html">Code Samples Index</A></FONT>
</DIV>
<P></P>
<h3>
e366.
Reading Properties from a Properties File</h3>
A properties filename has the form
<code>basename_locale.properties</code>. You only pass the string
<code>basename</code> to <code>getBundle()</code>.
<pre>
ResourceBundle bundle = ResourceBundle.getBundle(<font color="#0066ff"><i>"basename"</i></font>);
// Enumerate contents of resource bundle
for (Enumeration props = bundle.getKeys(); props.hasMoreElements(); ) {
String key = (String)props.nextElement();
<font color="#0066ff"><i>process</i></font>(key, bundle.getObject(key));
}
</pre>
<pre>java.util/ReadPropResource.java
b m java.util java.util.ResourceBundle.getBundle(java.lang.String)
e m java.util java.util.Enumeration.hasMoreElements()
e m java.util java.util.Enumeration.nextElement()
e m java.util java.util.ResourceBundle.getKeys()
e m java.util java.util.ResourceBundle.getObject(java.lang.String)
n x java.lang java.lang.String
</pre>
<P></P>
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR>
<TD><A HREF="http://www.amazon.com/exec/obidos/ASIN/0201432994/xeo"><IMG BORDER="0" ALIGN="BOTTOM" HSPACE="10" SRC="../almanac00.jpg"></A></TD><TD VALIGN="MIDDLE"><FONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="-1">
Examples <FONT SIZE="-2"><SUP>TM</SUP></FONT> provided by permission of the publisher, Addison-Wesley, and
Author Patrick Chan.<BR>
Order this book from <a href="http://www.amazon.com/exec/obidos/ASIN/0201432994/xeo">Amazon</a></FONT></TD>
</TR>
</TABLE>
</FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -