Source Code Cross Referenced for PropertyResourceBundle.java in  » 6.0-JDK-Modules » j2me » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * @(#)PropertyResourceBundle.java	1.25 06/10/10
004:         * 
005:         * Portions Copyright  2000-2006 Sun Microsystems, Inc. All Rights
006:         * Reserved.  Use is subject to license terms.
007:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
008:         * 
009:         * This program is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU General Public License version
011:         * 2 only, as published by the Free Software Foundation.
012:         * 
013:         * This program is distributed in the hope that it will be useful, but
014:         * WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016:         * General Public License version 2 for more details (a copy is
017:         * included at /legal/license.txt).
018:         * 
019:         * You should have received a copy of the GNU General Public License
020:         * version 2 along with this work; if not, write to the Free Software
021:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022:         * 02110-1301 USA
023:         * 
024:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
025:         * Clara, CA 95054 or visit www.sun.com if you need additional
026:         * information or have any questions.
027:         */
028:
029:        /*
030:         * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
031:         * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
032:         *
033:         * The original version of this source code and documentation
034:         * is copyrighted and owned by Taligent, Inc., a wholly-owned
035:         * subsidiary of IBM. These materials are provided under terms
036:         * of a License Agreement between Taligent and Sun. This technology
037:         * is protected by multiple US and International patents.
038:         *
039:         * This notice and attribution to Taligent may not be removed.
040:         * Taligent is a registered trademark of Taligent, Inc.
041:         */
042:
043:        package java.util;
044:
045:        import java.io.InputStream;
046:        import java.io.IOException;
047:
048:        /**
049:         * <code>PropertyResourceBundle</code> is a concrete subclass of
050:         * <code>ResourceBundle</code> that manages resources for a locale
051:         * using a set of static strings from a property file. See
052:         * {@link ResourceBundle ResourceBundle} for more information about resource
053:         * bundles. See {@link Properties Properties} for more information
054:         * about properties files, in particular the
055:         * <a href="Properties.html#encoding">information on character encodings</a>.
056:         *
057:         * <p>
058:         * Unlike other types of resource bundle, you don't subclass
059:         * <code>PropertyResourceBundle</code>.  Instead, you supply properties
060:         * files containing the resource data.  <code>ResourceBundle.getBundle</code>
061:         * will automatically look for the appropriate properties file and create a
062:         * <code>PropertyResourceBundle</code> that refers to it. See
063:         * {@link ResourceBundle#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader) ResourceBundle.getBundle}
064:         * for a complete description of the search and instantiation strategy.
065:         *
066:         * <p>
067:         * The following <a name="sample">example</a> shows a member of a resource
068:         * bundle family with the base name "MyResources".
069:         * The text defines the bundle "MyResources_de",
070:         * the German member of the bundle family.
071:         * This member is based on <code>PropertyResourceBundle</code>, and the text
072:         * therefore is the content of the file "MyResources_de.properties"
073:         * (a related <a href="ListResourceBundle.html#sample">example</a> shows
074:         * how you can add bundles to this family that are implemented as subclasses
075:         * of <code>ListResourceBundle</code>).
076:         * The keys in this example are of the form "s1" etc. The actual
077:         * keys are entirely up to your choice, so long as they are the same as
078:         * the keys you use in your program to retrieve the objects from the bundle.
079:         * Keys are case-sensitive.
080:         * <blockquote>
081:         * <pre>
082:         * # MessageFormat pattern
083:         * s1=Die Platte \"{1}\" enth&auml;lt {0}.
084:         *
085:         * # location of {0} in pattern
086:         * s2=1
087:         *
088:         * # sample disk name
089:         * s3=Meine Platte
090:         *
091:         * # first ChoiceFormat choice
092:         * s4=keine Dateien
093:         *
094:         * # second ChoiceFormat choice
095:         * s5=eine Datei
096:         *
097:         * # third ChoiceFormat choice
098:         * s6={0,number} Dateien
099:         *
100:         * # sample date
101:         * s7=3. M&auml;rz 1996
102:         * </pre>
103:         * </blockquote>
104:         *
105:         * @see ResourceBundle
106:         * @see ListResourceBundle
107:         * @see Properties
108:         * @since JDK1.1
109:         */
110:        public class PropertyResourceBundle extends ResourceBundle {
111:            /**
112:             * Creates a property resource bundle.
113:             * @param stream property file to read from.
114:             */
115:            public PropertyResourceBundle(InputStream stream)
116:                    throws IOException {
117:                Properties properties = new Properties();
118:                properties.load(stream);
119:                lookup = new HashMap(properties);
120:            }
121:
122:            // Implements java.util.ResourceBundle.handleGetObject; inherits javadoc specification.
123:            public Object handleGetObject(String key) {
124:                if (key == null) {
125:                    throw new NullPointerException();
126:                }
127:                return lookup.get(key);
128:            }
129:
130:            /**
131:             * Implementation of ResourceBundle.getKeys.
132:             */
133:            public Enumeration getKeys() {
134:                ResourceBundle parent = this .parent;
135:                return new ResourceBundleEnumeration(lookup.keySet(),
136:                        (parent != null) ? parent.getKeys() : null);
137:            }
138:
139:            // ==================privates====================
140:
141:            private Map lookup;
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.