From 2710f9f8e69b2a58f292a3934fff3f8d04842ad9 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 16 Oct 2023 18:33:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/parsing/LayoutParser.java | 8 ++++++++ .../cokr/xit/fims/crdn/parsing/SingleFileParser.java | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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; }