OSDN Git Service

20170130
authorkuboryu <kuboryu@yahoo.co.jp>
Sun, 29 Jan 2017 22:56:57 +0000 (07:56 +0900)
committerkuboryu <kuboryu@yahoo.co.jp>
Sun, 29 Jan 2017 22:56:57 +0000 (07:56 +0900)
com/rapide_act/CmnUtils.java

index afe97a8..f7bc7e4 100644 (file)
@@ -33,7 +33,7 @@ import org.apache.commons.codec.binary.Base64;
 
 public class CmnUtils{
        
-       public static void writeCsv(String _file, int _columnCount, ArrayList<String> _alData) throws Exception{
+       protected static void writeCsv(String _file, int _columnCount, ArrayList<String> _alData) throws Exception{
                PrintWriter pw = null;
                try {
                        debugPrint("Start write csv," + "columnCount=" + _columnCount);
@@ -58,7 +58,7 @@ public class CmnUtils{
                }
        }
 
-       public static void printConsole(int _columnCount, ArrayList<String> _alData) throws Exception{
+       protected static void printConsole(int _columnCount, ArrayList<String> _alData) throws Exception{
                try {
                        debugPrint("Start console print");
                        for(int i=0;i<_alData.size();i++){
@@ -80,34 +80,34 @@ public class CmnUtils{
                }
        }
 
-       public static void debugPrint(String _message) throws Exception{
+       protected static void debugPrint(String _message) throws Exception{
                if(System.getProperty("debug")!=null)System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [DEBUG] " + _message);
        }
 
-       public static void debugPrinting(String _message) throws Exception{
+       protected static void debugPrinting(String _message) throws Exception{
                if(System.getProperty("debug")!=null)System.out.print(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [DEBUG] " + _message);
        }
 
-       public static void infoPrint(String _message) throws Exception{
+       protected static void infoPrint(String _message) throws Exception{
                System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [INFO] " + _message);
        }
-       public static void infoPrinting(String _message) throws Exception{
+       protected static void infoPrinting(String _message) throws Exception{
                System.out.print(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [INFO] " + _message);
        }
 
-       public static void errorPrint(String _message) throws Exception{
+       protected static void errorPrint(String _message) throws Exception{
                System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date()) + " [ERROR] " + _message);
        }
 
-       public static String getTimestamp() throws Exception{
+       protected static String getTimestamp() throws Exception{
                return (new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
        }
 
-       public static String getYmdhm() throws Exception{
+       protected static String getYmdhm() throws Exception{
                return (new java.text.SimpleDateFormat("yyyyMMddHHmm").format(new Date()));
        }
 
-       public static int getArrayRowNo(ArrayList<String> _al, int _alMember, int _seq, String _value) throws Exception {
+       protected static int getArrayRowNo(ArrayList<String> _al, int _alMember, int _seq, String _value) throws Exception {
                int ret = -1;
                for(int i=0;i<_al.size()/_alMember;i++){
                        if(_al.get(i*_alMember + _seq).equals(_value)){
@@ -118,7 +118,7 @@ public class CmnUtils{
                return ret;
        }
 
-       public static String [] getArrayRowData(ArrayList<String> _al, int _alMember, int _row) throws Exception {
+       protected static String [] getArrayRowData(ArrayList<String> _al, int _alMember, int _row) throws Exception {
                String [] rowData = new String[_alMember];
                int colNo = 0;
                for(int i=_row*_alMember;i<_row*_alMember + _alMember;i++){
@@ -128,37 +128,37 @@ public class CmnUtils{
                return rowData;
        }
 
-       public static String [] splitCsv(String _line) throws Exception {
+       protected static String [] splitCsv(String _line) throws Exception {
                return split(_line, ",");
        }
 
-       public static String [] splitSpace(String _line) throws Exception {
+       protected static String [] splitSpace(String _line) throws Exception {
                return split(_line, " ");
        }
 
-       public static String [] splitDot(String _line) throws Exception {
+       protected static String [] splitDot(String _line) throws Exception {
                return split(_line, "\\.");
        }
        
-       public static String [] splitCrLf(String _line) throws Exception {
+       protected static String [] splitCrLf(String _line) throws Exception {
                return split(_line, "\r\n");
        }
 
-       public static String [] splitSlash(String _line) throws Exception {
+       protected static String [] splitSlash(String _line) throws Exception {
                return split(_line, "/");
        }
 
-       public static String [] splitTab(String _line) throws Exception {
+       protected static String [] splitTab(String _line) throws Exception {
                return split(_line, "\t");
        }
 
-       public static String [] split(String _line, String _delim) throws Exception {
+       protected static String [] split(String _line, String _delim) throws Exception {
                String [] strSplit;
                strSplit = _line.split(_delim, -1);
                return strSplit;
        }
        
-       public static boolean isLastCrLf(String _str) throws Exception{
+       protected static boolean isLastCrLf(String _str) throws Exception{
                boolean rtn = false;
                char[] charArray = _str.toCharArray();
                if (_str.length() > 1){
@@ -169,8 +169,8 @@ public class CmnUtils{
                return rtn;
        }
 
-       public static char[] hexArray = "0123456789ABCDEF".toCharArray();
-       public static String bytesToHex(byte[] _bytes){
+       protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
+       protected static String bytesToHex(byte[] _bytes){
                char[] hexChars = new char[_bytes.length * 2];
                for(int j=0;j<_bytes.length;j++){
                        int v = _bytes[j] & 0xFF;
@@ -179,7 +179,7 @@ public class CmnUtils{
                }
                return new String(hexChars);
        }
-       public static byte[] hexToBytes(String _hex){
+       protected static byte[] hexToBytes(String _hex){
                byte[] bytes = new byte[_hex.length()/2];
                for(int j=0;j<_hex.length()/2;j++){
                        bytes[j] = (byte)Integer.parseInt(_hex.substring(j*2,(j+1)*2),16);
@@ -187,22 +187,22 @@ public class CmnUtils{
                return bytes;
        }
 
-       public static String bytesToBase64(byte[] _bytes){
+       protected static String bytesToBase64(byte[] _bytes){
                return new String(Base64.encodeBase64(_bytes));
        }
-       public static byte[] base64ToBytes(String _base64){
+       protected static byte[] base64ToBytes(String _base64){
                return Base64.decodeBase64(_base64.getBytes());
        }
 
-       public static String clobToString(Clob _clob) throws Exception{
+       protected static String clobToString(Clob _clob) throws Exception{
                return _clob.getSubString(1, (int)_clob.length());
        }
 
-       public static String getLineSeparator(){
+       protected static String getLineSeparator(){
                return System.getProperty("line.separator");
        }
 
-       public static boolean isMatch(String [] _tables, String _table) throws Exception{
+       protected static boolean isMatch(String [] _tables, String _table) throws Exception{
                boolean rtn = false;
                Pattern p = null;
                Matcher m = null;
@@ -221,7 +221,7 @@ public class CmnUtils{
                return rtn;
        }
        
-       public static String getYesNo(boolean _bln){
+       protected static String getYesNo(boolean _bln){
                String retVal;
                if(_bln){
                        retVal = "Yes";
@@ -231,7 +231,7 @@ public class CmnUtils{
                return retVal;
        }
 
-       public static boolean isMatch(String [] _tabCols, String _table, String _col) throws Exception{
+       protected static boolean isMatch(String [] _tabCols, String _table, String _col) throws Exception{
                boolean rtn = false;
                Pattern p = null;
                Matcher m = null;
@@ -257,7 +257,7 @@ public class CmnUtils{
                return rtn;
        }
 
-       public static boolean isJapanese(String _str) throws Exception{
+       protected static boolean isJapanese(String _str) throws Exception{
                for(int i=0;i<_str.length();i++){
                        char chr = _str.charAt(i);
                        Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(chr);
@@ -270,7 +270,7 @@ public class CmnUtils{
                return false;
        }
 
-       public static boolean isHankaku(char _chr) throws Exception{
+       protected static boolean isHankaku(char _chr) throws Exception{
                if((_chr <= '\u007e') || (_chr == '\u00a5') || (_chr == '\u203e') || (_chr >= '\uff61' && _chr <= '\uff9f')){
                        return true;
                } else {
@@ -278,7 +278,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColString(String _str) throws Exception{
+       protected static boolean isColString(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("XML") ||
                        _str.toUpperCase().equals("UNIQUEIDENTIFIER") ||
@@ -299,7 +299,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColDate(String _str) throws Exception{
+       protected static boolean isColDate(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("DATE")){
                        return true;
@@ -308,7 +308,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColTime(String _str) throws Exception{
+       protected static boolean isColTime(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("TIME")){
                        return true;
@@ -317,7 +317,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColTimestamp(String _str) throws Exception{
+       protected static boolean isColTimestamp(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("TIMESTAMP") ||
                        _str.toUpperCase().equals("SMALLDATETIME") ||
@@ -329,7 +329,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColBigDecimal(String _str) throws Exception{
+       protected static boolean isColBigDecimal(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("NUMERIC") ||
                        _str.toUpperCase().equals("NUMBER") ||
@@ -342,7 +342,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColShort(String _str) throws Exception{
+       protected static boolean isColShort(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("TINYINT") ||
                        _str.toUpperCase().equals("SMALLINT")){
@@ -352,7 +352,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColInt(String _str) throws Exception{
+       protected static boolean isColInt(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("INTEGER") ||
                        _str.toUpperCase().equals("INT")){
@@ -362,7 +362,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColFloat(String _str) throws Exception{
+       protected static boolean isColFloat(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("REAL") ||
                        _str.toUpperCase().equals("SMALLFLT")){
@@ -372,7 +372,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColDouble(String _str) throws Exception{
+       protected static boolean isColDouble(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("FLOAT") ||
                        _str.toUpperCase().equals("DOUBLE PRECISION")){
@@ -382,7 +382,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColBytes(String _str) throws Exception{
+       protected static boolean isColBytes(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("RAW") ||
                        _str.toUpperCase().equals("BINARY")){
@@ -392,7 +392,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColBlob(String _str) throws Exception{
+       protected static boolean isColBlob(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("BLOB") ||
                        _str.toUpperCase().equals("VARBINARY") ||
@@ -404,7 +404,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isColClob(String _str) throws Exception{
+       protected static boolean isColClob(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("CLOB") ||
                        _str.toUpperCase().equals("NCLOB")){
@@ -414,7 +414,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isLob(String _str) throws Exception{
+       protected static boolean isLob(String _str) throws Exception{
                if(
                        isColClob(_str) || isColBlob(_str)){
                        return true;
@@ -423,7 +423,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isEmpty(String _str) throws Exception{
+       protected static boolean isEmpty(String _str) throws Exception{
                if(_str == null || _str.equals("")){
                        return true;
                } else {
@@ -431,7 +431,7 @@ public class CmnUtils{
                }
        }
 
-       public static boolean isNumeric(String _str) {
+       protected static boolean isNumeric(String _str) {
                boolean retVal = true;
                try {
                        int val = Integer.parseInt(_str);
@@ -441,7 +441,7 @@ public class CmnUtils{
                return retVal;
        }
 
-       public static String[] getSystemProperty(String _str) throws Exception{
+       protected static String[] getSystemProperty(String _str) throws Exception{
                String [] retValue = null;
                if(System.getProperty(_str)!=null){
                        retValue = splitCsv(System.getProperty(_str).toUpperCase());
@@ -449,7 +449,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static String getSystemProperty(String _str, String _strDefault) throws Exception{
+       protected static String getSystemProperty(String _str, String _strDefault) throws Exception{
                String retValue = _strDefault;
                if(System.getProperty(_str)!=null){
                        retValue = System.getProperty(_str).toUpperCase();
@@ -457,7 +457,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static char getSystemProperty(String _str, char _chrDefault) throws Exception{
+       protected static char getSystemProperty(String _str, char _chrDefault) throws Exception{
                char retValue = _chrDefault;
                if(System.getProperty(_str)!=null){
                        retValue = System.getProperty(_str).toUpperCase().charAt(0);
@@ -465,7 +465,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static boolean getSystemProperty(String _str, boolean _blnDefault) throws Exception{
+       protected static boolean getSystemProperty(String _str, boolean _blnDefault) throws Exception{
                boolean retValue = _blnDefault;
                if(System.getProperty(_str)!=null){
                        if(System.getProperty(_str).toUpperCase().equals("Y")){
@@ -479,7 +479,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static String getSeparator(String _str, String _strDefault) throws Exception{
+       protected static String getSeparator(String _str, String _strDefault) throws Exception{
                String retValue = _strDefault;
                if(System.getProperty(_str)!=null){
                        String _sprtr = System.getProperty(_str);
@@ -517,7 +517,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static String getDelimiter(String _str) throws Exception{
+       protected static String getDelimiter(String _str) throws Exception{
                String retValue = _str;
                if(_str!=null){
                        char [] chr = new char[_str.length()];
@@ -554,7 +554,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static String getLineSeparator(String _str, String _strDefault) throws Exception{
+       protected static String getLineSeparator(String _str, String _strDefault) throws Exception{
                String retValue = _strDefault;
                if(System.getProperty(_str)!=null){
                        String _sprtr = System.getProperty(_str);
@@ -587,7 +587,7 @@ public class CmnUtils{
                return retValue;
        }
 
-       public static String getLineSeparator(String _str) throws Exception{
+       protected static String getLineSeparator(String _str) throws Exception{
                String retValue = _str;
                if(_str!=null){
                        char [] chr = new char[_str.length()];