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