0
Java의 gzip 파일에서 추출한 파일의 타임 스탬프를 보존하고 싶습니다. GZIPInputStream
클래스는 당신에게 타임 스탬프를 제공 할 수 없기 때문에 이것은 해키 솔루션입니다Java에서 gzip 내의 파일에 타임 스탬프를 얻는 방법
public void gunzipFile(String zipFile, String newFile) {
System.out.println("zipFile: " + zipFile);
final int bufferSize = 1024;
try {
FileInputStream fis = new FileInputStream(zipFile);
BufferedInputStream bis = new BufferedInputStream(fis);
GZIPInputStream gis = new GZIPInputStream(bis);
FileOutputStream fos = new FileOutputStream(newFile);
final byte[] buffer = new byte[bufferSize];
int len = 0;
while ((len = gis.read(buffer)) != -1) {
fos.write(buffer, 0, len);
}
//close resources
fos.close();
gis.close();
} catch (IOException e) {
System.out.println("exception caught");
}
}
위대한 답변! 그게 저에게 일할 수있는 기회를줍니다. 감사합니다 – Marvado
@Marvado 당신은 오신 것을 환영합니다. 모든 사항을 다룰 수 있다면 대답을 수락하십시오. –