• R/O
  • SSH
  • HTTPS

dbdiffreport: Commit


Commit MetaInfo

Revision346 (tree)
Time2021-02-04 00:15:38
Authort0145jp

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunk/JunkBox/src/junkbox/P.java (revision 345)
+++ trunk/JunkBox/src/junkbox/P.java (nonexistent)
@@ -1,65 +0,0 @@
1-package junkbox;
2-
3-import java.io.FileInputStream;
4-import java.util.Properties;
5-
6-public class P {
7-
8- private static Properties p;
9-
10- public static void init() {
11- FileInputStream in = null;
12- try {
13- String filename = P.class.getResource("resources.properties").getFile();
14- Properties tmp = new Properties();
15- in = new FileInputStream(filename);
16- tmp.load(in);
17- p = tmp;
18- } catch (Exception e) {
19- e.printStackTrace();
20- } finally {
21- if (in != null) {
22- try {
23- in.close();
24- } catch (Exception e) {
25- e.printStackTrace();
26- }
27- }
28- }
29- }
30-
31- private static String getString(String key) {
32- if (p == null) {
33- init();
34- }
35- return p.getProperty(key);
36- }
37-
38- private static int getInt(String key) {
39- return Integer.valueOf(getString(key));
40- }
41-
42- private static long getLong(String key) {
43- return Long.valueOf(getString(key));
44- }
45-
46- private static boolean isTrue(String key) {
47- String s = getString(key).toLowerCase();
48- if (s.equals("1")) return true;
49- if (s.equals("on")) return true;
50- if (s.equals("yes")) return true;
51- if (s.equals("true")) return true;
52- return false;
53- }
54-
55- public static String getXxxYyy() {
56- return getString("XxxYyy");
57- }
58-
59- static public void main(String[] args) {
60- isTrue("xxxFlag");
61- getInt("xxxInt");
62- getLong("xxxLong");
63- getString("xxxString");
64- }
65-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- trunk/JunkBox/src/logic/Define.java (nonexistent)
+++ trunk/JunkBox/src/logic/Define.java (revision 346)
@@ -0,0 +1,80 @@
1+package logic;
2+
3+import java.io.FileInputStream;
4+import java.util.Properties;
5+
6+public class Define {
7+
8+ private static Properties p;
9+
10+ public static void init() {
11+ FileInputStream in = null;
12+ try {
13+ String filename = Define.class.getResource("const.properties").getFile();
14+ Properties tmp = new Properties();
15+ in = new FileInputStream(filename);
16+ tmp.load(in);
17+ p = tmp;
18+ } catch (Exception e) {
19+ e.printStackTrace();
20+ } finally {
21+ if (in != null) {
22+ try {
23+ in.close();
24+ } catch (Exception e) {
25+ e.printStackTrace();
26+ }
27+ }
28+ }
29+ }
30+
31+ private static String getString(String key) {
32+ if (p == null) {
33+ init();
34+ }
35+ return p.getProperty(key);
36+ }
37+
38+ private static int getInt(String key) {
39+ return Integer.valueOf(getString(key));
40+ }
41+
42+ private static long getLong(String key) {
43+ return Long.valueOf(getString(key));
44+ }
45+
46+ private static boolean isTrue(String key) {
47+ String s = getString(key).toLowerCase();
48+ if (s.equals("1")) return true;
49+ if (s.equals("on")) return true;
50+ if (s.equals("yes")) return true;
51+ if (s.equals("true")) return true;
52+ return false;
53+ }
54+
55+ private static String[] getStringList(String key) {
56+ return getString(key).split(",");
57+ }
58+
59+ /*
60+ * define
61+ */
62+
63+ public static final String DEFINE_STRING = getString("test.string");
64+ public static final int DEFINE_INT = getInt("test.int");
65+ public static final long DEFINE_LONG = getLong("test.long");
66+ public static final boolean DEFINE_BOOLEAN= isTrue("test.boolean");
67+ public static final String[] DEFINE_STRINGLIST = getStringList("test.stringList");
68+
69+ /*
70+ * test
71+ */
72+
73+ public static void main(String[] args) {
74+ System.out.println(DEFINE_STRING);
75+ System.out.println(DEFINE_INT);
76+ System.out.println(DEFINE_LONG);
77+ System.out.println(DEFINE_BOOLEAN);
78+ for (String s : DEFINE_STRINGLIST) System.out.println(s);
79+ }
80+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Show on old repository browser