Revision | 1747a545f7584591d674699100498395a94c38ac (tree) |
---|---|
Time | 2017-01-30 07:56:57 |
Author | kuboryu <kuboryu@yaho...> |
Commiter | kuboryu |
20170130
@@ -33,7 +33,7 @@ import org.apache.commons.codec.binary.Base64; | ||
33 | 33 | |
34 | 34 | public class CmnUtils{ |
35 | 35 | |
36 | - public static void writeCsv(String _file, int _columnCount, ArrayList<String> _alData) throws Exception{ | |
36 | + protected static void writeCsv(String _file, int _columnCount, ArrayList<String> _alData) throws Exception{ | |
37 | 37 | PrintWriter pw = null; |
38 | 38 | try { |
39 | 39 | debugPrint("Start write csv," + "columnCount=" + _columnCount); |
@@ -58,7 +58,7 @@ public class CmnUtils{ | ||
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public static void printConsole(int _columnCount, ArrayList<String> _alData) throws Exception{ | |
61 | + protected static void printConsole(int _columnCount, ArrayList<String> _alData) throws Exception{ | |
62 | 62 | try { |
63 | 63 | debugPrint("Start console print"); |
64 | 64 | for(int i=0;i<_alData.size();i++){ |
@@ -80,34 +80,34 @@ public class CmnUtils{ | ||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - public static void debugPrint(String _message) throws Exception{ | |
83 | + protected static void debugPrint(String _message) throws Exception{ | |
84 | 84 | if(System.getProperty("debug")!=null)System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [DEBUG] " + _message); |
85 | 85 | } |
86 | 86 | |
87 | - public static void debugPrinting(String _message) throws Exception{ | |
87 | + protected static void debugPrinting(String _message) throws Exception{ | |
88 | 88 | if(System.getProperty("debug")!=null)System.out.print(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [DEBUG] " + _message); |
89 | 89 | } |
90 | 90 | |
91 | - public static void infoPrint(String _message) throws Exception{ | |
91 | + protected static void infoPrint(String _message) throws Exception{ | |
92 | 92 | System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [INFO] " + _message); |
93 | 93 | } |
94 | - public static void infoPrinting(String _message) throws Exception{ | |
94 | + protected static void infoPrinting(String _message) throws Exception{ | |
95 | 95 | System.out.print(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [INFO] " + _message); |
96 | 96 | } |
97 | 97 | |
98 | - public static void errorPrint(String _message) throws Exception{ | |
98 | + protected static void errorPrint(String _message) throws Exception{ | |
99 | 99 | System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [ERROR] " + _message); |
100 | 100 | } |
101 | 101 | |
102 | - public static String getTimestamp() throws Exception{ | |
102 | + protected static String getTimestamp() throws Exception{ | |
103 | 103 | return (new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())); |
104 | 104 | } |
105 | 105 | |
106 | - public static String getYmdhm() throws Exception{ | |
106 | + protected static String getYmdhm() throws Exception{ | |
107 | 107 | return (new java.text.SimpleDateFormat("yyyyMMddHHmm").format(new Date())); |
108 | 108 | } |
109 | 109 | |
110 | - public static int getArrayRowNo(ArrayList<String> _al, int _alMember, int _seq, String _value) throws Exception { | |
110 | + protected static int getArrayRowNo(ArrayList<String> _al, int _alMember, int _seq, String _value) throws Exception { | |
111 | 111 | int ret = -1; |
112 | 112 | for(int i=0;i<_al.size()/_alMember;i++){ |
113 | 113 | if(_al.get(i*_alMember + _seq).equals(_value)){ |
@@ -118,7 +118,7 @@ public class CmnUtils{ | ||
118 | 118 | return ret; |
119 | 119 | } |
120 | 120 | |
121 | - public static String [] getArrayRowData(ArrayList<String> _al, int _alMember, int _row) throws Exception { | |
121 | + protected static String [] getArrayRowData(ArrayList<String> _al, int _alMember, int _row) throws Exception { | |
122 | 122 | String [] rowData = new String[_alMember]; |
123 | 123 | int colNo = 0; |
124 | 124 | for(int i=_row*_alMember;i<_row*_alMember + _alMember;i++){ |
@@ -128,37 +128,37 @@ public class CmnUtils{ | ||
128 | 128 | return rowData; |
129 | 129 | } |
130 | 130 | |
131 | - public static String [] splitCsv(String _line) throws Exception { | |
131 | + protected static String [] splitCsv(String _line) throws Exception { | |
132 | 132 | return split(_line, ","); |
133 | 133 | } |
134 | 134 | |
135 | - public static String [] splitSpace(String _line) throws Exception { | |
135 | + protected static String [] splitSpace(String _line) throws Exception { | |
136 | 136 | return split(_line, " "); |
137 | 137 | } |
138 | 138 | |
139 | - public static String [] splitDot(String _line) throws Exception { | |
139 | + protected static String [] splitDot(String _line) throws Exception { | |
140 | 140 | return split(_line, "\\."); |
141 | 141 | } |
142 | 142 | |
143 | - public static String [] splitCrLf(String _line) throws Exception { | |
143 | + protected static String [] splitCrLf(String _line) throws Exception { | |
144 | 144 | return split(_line, "\r\n"); |
145 | 145 | } |
146 | 146 | |
147 | - public static String [] splitSlash(String _line) throws Exception { | |
147 | + protected static String [] splitSlash(String _line) throws Exception { | |
148 | 148 | return split(_line, "/"); |
149 | 149 | } |
150 | 150 | |
151 | - public static String [] splitTab(String _line) throws Exception { | |
151 | + protected static String [] splitTab(String _line) throws Exception { | |
152 | 152 | return split(_line, "\t"); |
153 | 153 | } |
154 | 154 | |
155 | - public static String [] split(String _line, String _delim) throws Exception { | |
155 | + protected static String [] split(String _line, String _delim) throws Exception { | |
156 | 156 | String [] strSplit; |
157 | 157 | strSplit = _line.split(_delim, -1); |
158 | 158 | return strSplit; |
159 | 159 | } |
160 | 160 | |
161 | - public static boolean isLastCrLf(String _str) throws Exception{ | |
161 | + protected static boolean isLastCrLf(String _str) throws Exception{ | |
162 | 162 | boolean rtn = false; |
163 | 163 | char[] charArray = _str.toCharArray(); |
164 | 164 | if (_str.length() > 1){ |
@@ -169,8 +169,8 @@ public class CmnUtils{ | ||
169 | 169 | return rtn; |
170 | 170 | } |
171 | 171 | |
172 | - public static char[] hexArray = "0123456789ABCDEF".toCharArray(); | |
173 | - public static String bytesToHex(byte[] _bytes){ | |
172 | + protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); | |
173 | + protected static String bytesToHex(byte[] _bytes){ | |
174 | 174 | char[] hexChars = new char[_bytes.length * 2]; |
175 | 175 | for(int j=0;j<_bytes.length;j++){ |
176 | 176 | int v = _bytes[j] & 0xFF; |
@@ -179,7 +179,7 @@ public class CmnUtils{ | ||
179 | 179 | } |
180 | 180 | return new String(hexChars); |
181 | 181 | } |
182 | - public static byte[] hexToBytes(String _hex){ | |
182 | + protected static byte[] hexToBytes(String _hex){ | |
183 | 183 | byte[] bytes = new byte[_hex.length()/2]; |
184 | 184 | for(int j=0;j<_hex.length()/2;j++){ |
185 | 185 | bytes[j] = (byte)Integer.parseInt(_hex.substring(j*2,(j+1)*2),16); |
@@ -187,22 +187,22 @@ public class CmnUtils{ | ||
187 | 187 | return bytes; |
188 | 188 | } |
189 | 189 | |
190 | - public static String bytesToBase64(byte[] _bytes){ | |
190 | + protected static String bytesToBase64(byte[] _bytes){ | |
191 | 191 | return new String(Base64.encodeBase64(_bytes)); |
192 | 192 | } |
193 | - public static byte[] base64ToBytes(String _base64){ | |
193 | + protected static byte[] base64ToBytes(String _base64){ | |
194 | 194 | return Base64.decodeBase64(_base64.getBytes()); |
195 | 195 | } |
196 | 196 | |
197 | - public static String clobToString(Clob _clob) throws Exception{ | |
197 | + protected static String clobToString(Clob _clob) throws Exception{ | |
198 | 198 | return _clob.getSubString(1, (int)_clob.length()); |
199 | 199 | } |
200 | 200 | |
201 | - public static String getLineSeparator(){ | |
201 | + protected static String getLineSeparator(){ | |
202 | 202 | return System.getProperty("line.separator"); |
203 | 203 | } |
204 | 204 | |
205 | - public static boolean isMatch(String [] _tables, String _table) throws Exception{ | |
205 | + protected static boolean isMatch(String [] _tables, String _table) throws Exception{ | |
206 | 206 | boolean rtn = false; |
207 | 207 | Pattern p = null; |
208 | 208 | Matcher m = null; |
@@ -221,7 +221,7 @@ public class CmnUtils{ | ||
221 | 221 | return rtn; |
222 | 222 | } |
223 | 223 | |
224 | - public static String getYesNo(boolean _bln){ | |
224 | + protected static String getYesNo(boolean _bln){ | |
225 | 225 | String retVal; |
226 | 226 | if(_bln){ |
227 | 227 | retVal = "Yes"; |
@@ -231,7 +231,7 @@ public class CmnUtils{ | ||
231 | 231 | return retVal; |
232 | 232 | } |
233 | 233 | |
234 | - public static boolean isMatch(String [] _tabCols, String _table, String _col) throws Exception{ | |
234 | + protected static boolean isMatch(String [] _tabCols, String _table, String _col) throws Exception{ | |
235 | 235 | boolean rtn = false; |
236 | 236 | Pattern p = null; |
237 | 237 | Matcher m = null; |
@@ -257,7 +257,7 @@ public class CmnUtils{ | ||
257 | 257 | return rtn; |
258 | 258 | } |
259 | 259 | |
260 | - public static boolean isJapanese(String _str) throws Exception{ | |
260 | + protected static boolean isJapanese(String _str) throws Exception{ | |
261 | 261 | for(int i=0;i<_str.length();i++){ |
262 | 262 | char chr = _str.charAt(i); |
263 | 263 | Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(chr); |
@@ -270,7 +270,7 @@ public class CmnUtils{ | ||
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | |
273 | - public static boolean isHankaku(char _chr) throws Exception{ | |
273 | + protected static boolean isHankaku(char _chr) throws Exception{ | |
274 | 274 | if((_chr <= '\u007e') || (_chr == '\u00a5') || (_chr == '\u203e') || (_chr >= '\uff61' && _chr <= '\uff9f')){ |
275 | 275 | return true; |
276 | 276 | } else { |
@@ -278,7 +278,7 @@ public class CmnUtils{ | ||
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | - public static boolean isColString(String _str) throws Exception{ | |
281 | + protected static boolean isColString(String _str) throws Exception{ | |
282 | 282 | if( |
283 | 283 | _str.toUpperCase().equals("XML") || |
284 | 284 | _str.toUpperCase().equals("UNIQUEIDENTIFIER") || |
@@ -299,7 +299,7 @@ public class CmnUtils{ | ||
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | - public static boolean isColDate(String _str) throws Exception{ | |
302 | + protected static boolean isColDate(String _str) throws Exception{ | |
303 | 303 | if( |
304 | 304 | _str.toUpperCase().equals("DATE")){ |
305 | 305 | return true; |
@@ -308,7 +308,7 @@ public class CmnUtils{ | ||
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | - public static boolean isColTime(String _str) throws Exception{ | |
311 | + protected static boolean isColTime(String _str) throws Exception{ | |
312 | 312 | if( |
313 | 313 | _str.toUpperCase().equals("TIME")){ |
314 | 314 | return true; |
@@ -317,7 +317,7 @@ public class CmnUtils{ | ||
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | - public static boolean isColTimestamp(String _str) throws Exception{ | |
320 | + protected static boolean isColTimestamp(String _str) throws Exception{ | |
321 | 321 | if( |
322 | 322 | _str.toUpperCase().equals("TIMESTAMP") || |
323 | 323 | _str.toUpperCase().equals("SMALLDATETIME") || |
@@ -329,7 +329,7 @@ public class CmnUtils{ | ||
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | - public static boolean isColBigDecimal(String _str) throws Exception{ | |
332 | + protected static boolean isColBigDecimal(String _str) throws Exception{ | |
333 | 333 | if( |
334 | 334 | _str.toUpperCase().equals("NUMERIC") || |
335 | 335 | _str.toUpperCase().equals("NUMBER") || |
@@ -342,7 +342,7 @@ public class CmnUtils{ | ||
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | - public static boolean isColShort(String _str) throws Exception{ | |
345 | + protected static boolean isColShort(String _str) throws Exception{ | |
346 | 346 | if( |
347 | 347 | _str.toUpperCase().equals("TINYINT") || |
348 | 348 | _str.toUpperCase().equals("SMALLINT")){ |
@@ -352,7 +352,7 @@ public class CmnUtils{ | ||
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | - public static boolean isColInt(String _str) throws Exception{ | |
355 | + protected static boolean isColInt(String _str) throws Exception{ | |
356 | 356 | if( |
357 | 357 | _str.toUpperCase().equals("INTEGER") || |
358 | 358 | _str.toUpperCase().equals("INT")){ |
@@ -362,7 +362,7 @@ public class CmnUtils{ | ||
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - public static boolean isColFloat(String _str) throws Exception{ | |
365 | + protected static boolean isColFloat(String _str) throws Exception{ | |
366 | 366 | if( |
367 | 367 | _str.toUpperCase().equals("REAL") || |
368 | 368 | _str.toUpperCase().equals("SMALLFLT")){ |
@@ -372,7 +372,7 @@ public class CmnUtils{ | ||
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | - public static boolean isColDouble(String _str) throws Exception{ | |
375 | + protected static boolean isColDouble(String _str) throws Exception{ | |
376 | 376 | if( |
377 | 377 | _str.toUpperCase().equals("FLOAT") || |
378 | 378 | _str.toUpperCase().equals("DOUBLE PRECISION")){ |
@@ -382,7 +382,7 @@ public class CmnUtils{ | ||
382 | 382 | } |
383 | 383 | } |
384 | 384 | |
385 | - public static boolean isColBytes(String _str) throws Exception{ | |
385 | + protected static boolean isColBytes(String _str) throws Exception{ | |
386 | 386 | if( |
387 | 387 | _str.toUpperCase().equals("RAW") || |
388 | 388 | _str.toUpperCase().equals("BINARY")){ |
@@ -392,7 +392,7 @@ public class CmnUtils{ | ||
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | - public static boolean isColBlob(String _str) throws Exception{ | |
395 | + protected static boolean isColBlob(String _str) throws Exception{ | |
396 | 396 | if( |
397 | 397 | _str.toUpperCase().equals("BLOB") || |
398 | 398 | _str.toUpperCase().equals("VARBINARY") || |
@@ -404,7 +404,7 @@ public class CmnUtils{ | ||
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | - public static boolean isColClob(String _str) throws Exception{ | |
407 | + protected static boolean isColClob(String _str) throws Exception{ | |
408 | 408 | if( |
409 | 409 | _str.toUpperCase().equals("CLOB") || |
410 | 410 | _str.toUpperCase().equals("NCLOB")){ |
@@ -414,7 +414,7 @@ public class CmnUtils{ | ||
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | - public static boolean isLob(String _str) throws Exception{ | |
417 | + protected static boolean isLob(String _str) throws Exception{ | |
418 | 418 | if( |
419 | 419 | isColClob(_str) || isColBlob(_str)){ |
420 | 420 | return true; |
@@ -423,7 +423,7 @@ public class CmnUtils{ | ||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - public static boolean isEmpty(String _str) throws Exception{ | |
426 | + protected static boolean isEmpty(String _str) throws Exception{ | |
427 | 427 | if(_str == null || _str.equals("")){ |
428 | 428 | return true; |
429 | 429 | } else { |
@@ -431,7 +431,7 @@ public class CmnUtils{ | ||
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | - public static boolean isNumeric(String _str) { | |
434 | + protected static boolean isNumeric(String _str) { | |
435 | 435 | boolean retVal = true; |
436 | 436 | try { |
437 | 437 | int val = Integer.parseInt(_str); |
@@ -441,7 +441,7 @@ public class CmnUtils{ | ||
441 | 441 | return retVal; |
442 | 442 | } |
443 | 443 | |
444 | - public static String[] getSystemProperty(String _str) throws Exception{ | |
444 | + protected static String[] getSystemProperty(String _str) throws Exception{ | |
445 | 445 | String [] retValue = null; |
446 | 446 | if(System.getProperty(_str)!=null){ |
447 | 447 | retValue = splitCsv(System.getProperty(_str).toUpperCase()); |
@@ -449,7 +449,7 @@ public class CmnUtils{ | ||
449 | 449 | return retValue; |
450 | 450 | } |
451 | 451 | |
452 | - public static String getSystemProperty(String _str, String _strDefault) throws Exception{ | |
452 | + protected static String getSystemProperty(String _str, String _strDefault) throws Exception{ | |
453 | 453 | String retValue = _strDefault; |
454 | 454 | if(System.getProperty(_str)!=null){ |
455 | 455 | retValue = System.getProperty(_str).toUpperCase(); |
@@ -457,7 +457,7 @@ public class CmnUtils{ | ||
457 | 457 | return retValue; |
458 | 458 | } |
459 | 459 | |
460 | - public static char getSystemProperty(String _str, char _chrDefault) throws Exception{ | |
460 | + protected static char getSystemProperty(String _str, char _chrDefault) throws Exception{ | |
461 | 461 | char retValue = _chrDefault; |
462 | 462 | if(System.getProperty(_str)!=null){ |
463 | 463 | retValue = System.getProperty(_str).toUpperCase().charAt(0); |
@@ -465,7 +465,7 @@ public class CmnUtils{ | ||
465 | 465 | return retValue; |
466 | 466 | } |
467 | 467 | |
468 | - public static boolean getSystemProperty(String _str, boolean _blnDefault) throws Exception{ | |
468 | + protected static boolean getSystemProperty(String _str, boolean _blnDefault) throws Exception{ | |
469 | 469 | boolean retValue = _blnDefault; |
470 | 470 | if(System.getProperty(_str)!=null){ |
471 | 471 | if(System.getProperty(_str).toUpperCase().equals("Y")){ |
@@ -479,7 +479,7 @@ public class CmnUtils{ | ||
479 | 479 | return retValue; |
480 | 480 | } |
481 | 481 | |
482 | - public static String getSeparator(String _str, String _strDefault) throws Exception{ | |
482 | + protected static String getSeparator(String _str, String _strDefault) throws Exception{ | |
483 | 483 | String retValue = _strDefault; |
484 | 484 | if(System.getProperty(_str)!=null){ |
485 | 485 | String _sprtr = System.getProperty(_str); |
@@ -517,7 +517,7 @@ public class CmnUtils{ | ||
517 | 517 | return retValue; |
518 | 518 | } |
519 | 519 | |
520 | - public static String getDelimiter(String _str) throws Exception{ | |
520 | + protected static String getDelimiter(String _str) throws Exception{ | |
521 | 521 | String retValue = _str; |
522 | 522 | if(_str!=null){ |
523 | 523 | char [] chr = new char[_str.length()]; |
@@ -554,7 +554,7 @@ public class CmnUtils{ | ||
554 | 554 | return retValue; |
555 | 555 | } |
556 | 556 | |
557 | - public static String getLineSeparator(String _str, String _strDefault) throws Exception{ | |
557 | + protected static String getLineSeparator(String _str, String _strDefault) throws Exception{ | |
558 | 558 | String retValue = _strDefault; |
559 | 559 | if(System.getProperty(_str)!=null){ |
560 | 560 | String _sprtr = System.getProperty(_str); |
@@ -587,7 +587,7 @@ public class CmnUtils{ | ||
587 | 587 | return retValue; |
588 | 588 | } |
589 | 589 | |
590 | - public static String getLineSeparator(String _str) throws Exception{ | |
590 | + protected static String getLineSeparator(String _str) throws Exception{ | |
591 | 591 | String retValue = _str; |
592 | 592 | if(_str!=null){ |
593 | 593 | char [] chr = new char[_str.length()]; |