diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java b/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java index 0797cf56..48e39528 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/LayoutParser.java @@ -70,6 +70,10 @@ abstract public class LayoutParser { this.descriptor = descriptor; } + /**파일에서 파일관련 기본정보를 추출한다.
+ * @param dataObject 정보, File 파일 + * @return + */ public void setFileDefaultInfo(DataObject dataObject, File file) { String filePath = file.getPath(); dataObject.put("FILE_PATH", filePath); @@ -195,6 +199,10 @@ abstract public class LayoutParser { } } + /**파일명이나 파일내용을 바이트로 자른다.
+ * @param string 문자열, sep 구분자 + * @return + */ public String[] smartSplit(String string, JSONArray jsonArray) { List byteNums = new ArrayList(); diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java b/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java index ca4cfb4e..c8740bf4 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/SingleFileParser.java @@ -99,15 +99,20 @@ public class SingleFileParser extends LayoutParser { String jpgName = ""; boolean jpgIn = false; int jpgNum = 0; + String jpgNamePiece = ""; for (int i = 0; i < imgContent.length(); i++) { boolean jpgStart = (i != imgContent.length()-1) && (imgContent.charAt(i) == 0xFF && imgContent.charAt(i+1) == 0xD8); boolean jpgEnd = (i != 0) && (imgContent.charAt(i-1) == 0xFF && imgContent.charAt(i) == 0xD9); + if(!jpgIn && !jpgStart) { + jpgNamePiece += imgContent.charAt(i); + } + if(jpgStart) { - jpgName = "" + imgContent.charAt(i-6)+imgContent.charAt(i-5)+imgContent.charAt(i-4) - + imgContent.charAt(i-3)+imgContent.charAt(i-2)+imgContent.charAt(i-1); + jpgName = jpgNamePiece; + jpgNamePiece = ""; jpgIn = true; }