From 83cb9b9bd5f0703b43ac14e64b373e124322ae6b Mon Sep 17 00:00:00 2001 From: leebj Date: Tue, 5 Nov 2024 14:51:39 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B8=EC=9E=90=EC=97=B4=20=EC=9D=B8?= =?UTF-8?q?=EC=BD=94=EB=94=A9=20=EA=B4=80=EB=A0=A8=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8?= =?UTF-8?q?=EC=9D=B4=EB=8F=99(fims-java-public)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 39 ++-- src/main/java/cokr/xit/fims/cmmn/Hangul.java | 217 ------------------- 2 files changed, 16 insertions(+), 240 deletions(-) delete mode 100644 src/main/java/cokr/xit/fims/cmmn/Hangul.java diff --git a/pom.xml b/pom.xml index 5b9f66d3..334c2bc1 100644 --- a/pom.xml +++ b/pom.xml @@ -9,14 +9,14 @@ 2.7.18 - + cokr.xit.app fims-java-all 1.0.0-SNAPSHOT fims-java-all 과태료통합관리시스템java전체 jar - + UTF-8 17 @@ -28,7 +28,7 @@ https://nas.xit.co.kr:8888/repository/maven-public/ - + maven-public @@ -41,9 +41,9 @@ - + - + org.egovframe.rte @@ -65,7 +65,7 @@ - + 3rd-party echelon @@ -76,7 +76,7 @@ dguard compile - + @@ -93,13 +93,6 @@ fims-java-rent 1.0.0-SNAPSHOT - - - - com.ibm.icu - icu4j - 75.1 - @@ -107,35 +100,35 @@ xit-disabled-parking 23.04.01-SNAPSHOT - + - + - + cokr.xit.interfaces xit-smg 23.04.01-SNAPSHOT - + - + cokr.xit.interfaces.lntris @@ -148,14 +141,14 @@ xit-lntris-special 23.04.01-SNAPSHOT - + cokr.xit.interfaces xit-epost 23.04.01-SNAPSHOT - + org.apache.pdfbox @@ -295,6 +288,6 @@ - - + + \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/cmmn/Hangul.java b/src/main/java/cokr/xit/fims/cmmn/Hangul.java deleted file mode 100644 index 2183782c..00000000 --- a/src/main/java/cokr/xit/fims/cmmn/Hangul.java +++ /dev/null @@ -1,217 +0,0 @@ -package cokr.xit.fims.cmmn; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -import com.ibm.icu.text.CharsetDetector; -import com.ibm.icu.text.CharsetMatch; - -public class Hangul { - - public Hangul(int hangulIsNByte){ - this.hangulIsNByte = hangulIsNByte; - } - - private int hangulIsNByte; - - public int is() { - return this.hangulIsNByte; - } - - /** - * 문자열의 바이트 수 구하기 - * - * @param str - * @return - */ - public int getByteLength(String str) { - if(str == null) { - return 0; - } - int byteLen = 0; - - for(int i=0;i 127) || (ch < 0)) { - byteLen += this.is(); - } else { - byteLen += 1; - } - } - - return byteLen; - } - - /** - * 문자열을 바이트 단위로 패딩 - * - * @param str - * @param byteLen - * @param ch - * @return - */ - public String lpadByte(String str, int byteLen, String ch) { - String result = str; - - int strLen = this.getByteLength(str); - - for(int i=0; i < byteLen - strLen ; i++) { - result = ch + result; - } - - return result; - } - - /** - * 문자열을 바이트 단위로 패딩 - * - * @param str - * @param byteLen - * @param ch - * @return - */ - public String rpadByte(String str, int byteLen, String ch) { - String result = str; - - int strLen = this.getByteLength(str); - - for(int i=0; i < byteLen - strLen ; i++) { - result += ch; - } - - return result; - } - - /** - * 문자열을 바이트 단위로 substring하기 - * - * @param str - * @param beginBytes - * @param endBytes - * @return - */ - public String substringByBytes(String str, int beginBytes, int endBytes) { - if (str == null || str.length() == 0) { - return ""; - } - - if (beginBytes < 0) { - beginBytes = 0; - } - - if (endBytes < 1) { - return ""; - } - - int len = str.length(); - - int beginIndex = -1; - int endIndex = 0; - - int curBytes = 0; - String ch = null; - for (int i = 0; i < len; i++) { - ch = str.substring(i, i + 1); - curBytes += this.getByteLength(ch); - - - if (beginIndex == -1 && curBytes >= beginBytes) { - beginIndex = i; - } - - if (curBytes > endBytes) { - break; - } else { - endIndex = i + 1; - } - } - - return str.substring(beginIndex, endIndex); - } - - /** - * 문자열을 바이트 단위로 substring하기 - * - * @param str - * @param beginBytes - * @return - */ - public String substringByBytes(String str, int beginBytes) { - if (str == null || str.length() == 0) { - return ""; - } - - if (beginBytes < 0) { - beginBytes = 0; - } - - int len = str.length(); - - int beginIndex = -1; - - int curBytes = 0; - String ch = null; - for (int i = 0; i < len; i++) { - ch = str.substring(i, i + 1); - curBytes += this.getByteLength(ch); - - - if (beginIndex == -1 && curBytes >= beginBytes) { - beginIndex = i; - } - - } - - return str.substring(beginIndex); - } - - /** - * 텍스트 인코딩 확인 - * - * @param path - * @return 캐릭터셋 - */ - public String encodingDetect(String path) throws IOException { - File f = new File(path); - - return encodingDetect(f); - } - - public String encodingDetect(File f) throws IOException { - CharsetDetector detector; - CharsetMatch match; - - FileInputStream fis = null; - try { - String result = ""; - - fis = new FileInputStream(f); - - byte[] byteData = new byte[(int) f.length()]; - - fis.read(byteData); - fis.close(); - detector = new CharsetDetector(); - - detector.setText(byteData); - match = detector.detect(); - - System.out.println("encoding is \"" + match.getName() + "\""); - - if(match.getName().equals("UTF-8") || match.getName().equals("EUC-KR")) { - result = match.getName(); - } else { - result = "EUC-KR"; - } - - return result; - } - finally { - IOUtils.closeQuietly(fis); - } - } -}