이 방법에 문제가 있습니다. 24 시간마다 (오전 3시에) 전화를하고 파일을 압축해야합니다. 처음에는 제대로 작동합니다. 두 번째 루프에서 zip 파일은 최대 4MB까지만 증가합니다 (1,5GB이어야 함). 내가 뭘 잘못 했니? (내 하찮은 영어 실력에 죄송하다는 말씀을 드리고 싶습니다). 코드는 다음과 같습니다.Zip 파일을 모두 24 시간 내
private static void zipFile(String srcfile, String desfile) throws IOException {
FileInputStream in = new FileInputStream(srcfile);
BufferedInputStream in2 = new BufferedInputStream(in);
FileOutputStream out = new FileOutputStream(desfile);
GZIPOutputStream zipOut = new GZIPOutputStream(out);
BufferedOutputStream out2 = new BufferedOutputStream(zipOut);
int chunk;
appendLog("start zip...");
while ((chunk = in2.read()) != -1) {
out2.write(chunk);
}
out2.close();
zipOut.close();
out.close();
appendLog("zipping file done: " + desfile);
}
'두 번째 루프에서'두 번째 루프는 무엇입니까? –
# 2 날의 zip 파일 내용이 손상되었거나 불완전한가요? –
"두 번째 루프"는 메서드가 호출 된 두 번째 시간을 의미한다고 생각합니다. –