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);
}
}
- 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++){
}
}
- 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)){
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++){
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){
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;
}
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);
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;
return rtn;
}
- public static String getYesNo(boolean _bln){
+ protected static String getYesNo(boolean _bln){
String retVal;
if(_bln){
retVal = "Yes";
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;
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);
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 {
}
}
- 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") ||
}
}
- public static boolean isColDate(String _str) throws Exception{
+ protected static boolean isColDate(String _str) throws Exception{
if(
_str.toUpperCase().equals("DATE")){
return true;
}
}
- public static boolean isColTime(String _str) throws Exception{
+ protected static boolean isColTime(String _str) throws Exception{
if(
_str.toUpperCase().equals("TIME")){
return true;
}
}
- 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") ||
}
}
- 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") ||
}
}
- 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")){
}
}
- 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")){
}
}
- 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")){
}
}
- 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")){
}
}
- 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")){
}
}
- 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") ||
}
}
- 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")){
}
}
- public static boolean isLob(String _str) throws Exception{
+ protected static boolean isLob(String _str) throws Exception{
if(
isColClob(_str) || isColBlob(_str)){
return true;
}
}
- public static boolean isEmpty(String _str) throws Exception{
+ protected static boolean isEmpty(String _str) throws Exception{
if(_str == null || _str.equals("")){
return true;
} else {
}
}
- public static boolean isNumeric(String _str) {
+ protected static boolean isNumeric(String _str) {
boolean retVal = true;
try {
int val = Integer.parseInt(_str);
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());
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();
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);
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")){
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);
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()];
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);
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()];