아이폰 앱 .ipa 파일의 압축을 풀고 싶습니다. 이것은 실제로 정상적으로 추출되는 zip 파일입니다. 그러나 실제 응용 프로그램 파일은 .app가 끝나는 폴더입니다 (모든 Mac 응용 프로그램은 실제로 .app가 끝나는 폴더 임). 이제는 기간이 java.util.zip의 문제인 것 같습니다.java.util.zip에 파일 이름/디렉토리 이름에 마침표가있는 문제가 있습니까?
Exception in thread "main" java.io.FileNotFoundException: Payload/SMA Jobs.app/06-magnifying-glass.png (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at Main.main(Main.java:27)
enter code here
사람은 그 기간을 처리하는 방법을 알고 :
public static void main(String[] args) throws IOException {
ZipFile zipFile = new ZipFile("file.zip");
String path = "";
Enumeration files = zipFile.entries();
while (files.hasMoreElements()) {
ZipEntry entry = (ZipEntry) files.nextElement();
if (entry.isDirectory()) {
File file = new File(path + entry.getName());
file.mkdir();
System.out.println("Create dir " + entry.getName());
} else {
File f = new File(entry.getName());
FileOutputStream fos = new FileOutputStream(f); //EXception occurs here
InputStream is = zipFile.getInputStream(entry);
byte[] buffer = new byte[1024];
int bytesRead = 0;
while ((bytesRead = is.read(buffer)) != -1) {
fos.write(buffer, 0, bytesRead);
}
fos.close();
System.out.println("Create File " + entry.getName());
}
}
}
이 내 출력입니까?
u는 getParentFile()을 의미합니다. – tzippy
그건 내 문제를 완전히 해결했습니다! 단케 스콘! – tzippy