/[schmitzm]/branches/2.4.x/src/skrueger/lang/PropertiesLoaded.java
ViewVC logotype

Annotation of /branches/2.4.x/src/skrueger/lang/PropertiesLoaded.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1383 - (hide annotations)
Wed Jan 26 13:46:20 2011 UTC (14 years, 1 month ago) by alfonx
File MIME type: text/plain
File size: 2490 byte(s)
trunk becomes 2.4.x ... starting to create multiple modules

1 alfonx 802 package skrueger.lang;
2    
3 alfonx 1183 import java.io.File;
4     import java.io.FileNotFoundException;
5     import java.io.IOException;
6 alfonx 802 import java.io.InputStream;
7     import java.net.URL;
8     import java.util.Properties;
9    
10     import org.apache.log4j.Logger;
11    
12 alfonx 1183 import schmitzm.io.FileOutputStream;
13    
14 alfonx 802 /**
15     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu initialisieren
16 alfonx 1183 * und mit den Werten einer Datei zu befüllen. Alle Exceptions werden zu
17 alfonx 802 * {@link RuntimeException}s.
18     *
19     * @author Stefan A. Tzeggai
20     *
21     */
22     public class PropertiesLoaded extends Properties {
23     private static Logger log = Logger.getLogger(PropertiesLoaded.class);
24    
25     /**
26     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu
27 alfonx 1183 * initialisieren und mit den Werten einer Datei zu befüllen. Alle
28 alfonx 802 * Exceptions werden zu {@link RuntimeException}s.
29     *
30     * @author Stefan A. Tzeggai
31     *
32     */
33     public PropertiesLoaded(URL loadFrom) {
34     super();
35    
36     load(loadFrom);
37     }
38    
39     /**
40     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu
41 alfonx 1183 * initialisieren und mit den Werten einer Datei zu befüllen. Alle
42 alfonx 802 * Exceptions werden zu {@link RuntimeException}s.
43     *
44     * @author Stefan A. Tzeggai
45     *
46     */
47     public PropertiesLoaded(URL loadFrom, Properties defaults) {
48     super(defaults);
49     load(loadFrom);
50     }
51    
52     /**
53     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu
54 alfonx 1183 * initialisieren und mit den Werten einer Datei zu befüllen. Alle
55 alfonx 802 * Exceptions werden zu {@link RuntimeException}s.
56     *
57     * @author Stefan A. Tzeggai
58     */
59     public PropertiesLoaded() {
60     super();
61     }
62    
63     /**
64     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu
65 alfonx 1183 * initialisieren und mit den Werten einer Datei zu befüllen. Alle
66 alfonx 802 * Exceptions werden zu {@link RuntimeException}s.
67     *
68     * @author Stefan A. Tzeggai
69     *
70     */
71     public PropertiesLoaded(Properties defaults) {
72     super(defaults);
73     }
74    
75     /**
76     * Erlaubt es eine {@link Properties} Instanz mit einer Zeile zu
77 alfonx 1183 * initialisieren und mit den Werten einer Datei zu befüllen. Alle
78 alfonx 802 * Exceptions werden zu {@link RuntimeException}s.
79     *
80     * @author Stefan A. Tzeggai
81     *
82     */
83     public void load(URL loadFrom) {
84     try {
85    
86     InputStream openStream = null;
87     try {
88     openStream = loadFrom.openStream();
89     load(openStream);
90     } finally {
91     if (openStream != null)
92     openStream.close();
93     }
94    
95     } catch (Exception e) {
96     throw new RuntimeException(e);
97     }
98     }
99    
100 alfonx 1183 public void save(File f) throws FileNotFoundException, IOException {
101     store(new FileOutputStream(f), "");
102     }
103    
104 alfonx 802 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26