파일체크 수정

This commit is contained in:
Harry M. You
2025-12-09 09:35:41 +09:00
parent c3245ab79c
commit ed45018877
2 changed files with 53 additions and 50 deletions

View File

@@ -13,6 +13,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.gce.geotiff.GeoTiffReader;
@@ -45,6 +47,7 @@ public class FIleChecker {
return true;
}
public static boolean verifyFileIntegrity(Path path, String expectedHash)
throws IOException, NoSuchAlgorithmException {
@@ -69,6 +72,7 @@ public class FIleChecker {
return actualHash.equalsIgnoreCase(expectedHash);
}
public static boolean checkTfw(String filePath) {
File file = new File(filePath);
@@ -151,18 +155,18 @@ public class FIleChecker {
List<String> command = new ArrayList<>();
//윈도우용
/*
command.add("cmd.exe"); // 윈도우 명령 프롬프트 실행
command.add("/c"); // 명령어를 수행하고 종료한다는 옵션
// command.add("C:\\Program Files\\QGIS 3.44.4\\bin\\gdalinfo");
command.add("gdalinfo");
command.add(filePath);
command.add("|");
command.add("findstr");
command.add("/i");
command.add("Geo");
*/
/*
command.add("sh"); // 윈도우 명령 프롬프트 실행
command.add("sh"); // 리눅스,맥 명령 프롬프트 실행
command.add("-c"); // 명령어를 수행하고 종료한다는 옵션
command.add("gdalinfo");
command.add(filePath);
@@ -170,7 +174,7 @@ public class FIleChecker {
command.add("grep");
command.add("-i");
command.add("Geo");
*/
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.redirectErrorStream(true);
@@ -179,7 +183,8 @@ public class FIleChecker {
Process process = processBuilder.start();
// 인코딩은 윈도우 한글 환경에 맞게 MS949로 지정
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
@@ -198,4 +203,5 @@ public class FIleChecker {
return hasDriver;
}
}

View File

@@ -41,7 +41,6 @@ public class MapSheetMngFileCheckerService {
public FoldersDto getFolderAll(SrchFoldersDto srchDto) {
System.out.println("getFolderAll === ");
Path startPath = Paths.get(srchDto.getDirPath());
String dirPath = srchDto.getDirPath();
@@ -120,8 +119,6 @@ public class MapSheetMngFileCheckerService {
throw new RuntimeException(e);
}
// FoldersDto foldersDto = new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt,
// folderDtoList);
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderDtoList);
}