File: PropLoader.java

package info (click to toggle)
libi18n-java 0.1.3a-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 244 kB
  • ctags: 324
  • sloc: java: 1,652; sh: 44; xml: 34; makefile: 12
file content (48 lines) | stat: -rw-r--r-- 1,524 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.workingfrog.i18n.test;

import java.io.FileInputStream;
import java.io.FileNotFoundException; 
import java.io.InputStream;
import java.io.IOException; 

import java.util.Properties;

import org.workingfrog.i18n.util.PropertiesLoader;

class PropLoader {
    public static void main (String[] argv) {
        InputStream input = PropLoader.class.getResourceAsStream("/org/workingfrog/i18n/test/bundles/misc.properties");
	if (input == null) {
            System.out.println("misc.properties not found");
	} else {
            System.out.println("misc.properties found!");
	}

        String path = System.getProperty("user.dir")
            + System.getProperty("file.separator") + "default.properties";
	System.out.println(path);
	try {
            input = new FileInputStream(path);
	} catch (FileNotFoundException fnfe) {
            System.out.println("default.properties not at " + path);
	}

	if (input == null) {
            System.out.println("default.properties not found");
	} else {
            System.out.println("default.properties loaded");
	}

	Properties props = new Properties();
	try {
	    props.load(input);
	} catch (IOException ioe) {
            System.out.println("IOException");
	}
	System.out.println("manual load, bundles.path : " + props.getProperty("bundles.path"));

	PropertiesLoader.init();
	System.out.println("PropertiesLoader, bundles.path : " + PropertiesLoader.getBundlesPath());
	System.out.println("PropertiesLoader, log level : " + PropertiesLoader.getLogLevel());
    }
}