Ich möchte mein Archiv identifizieren, unabhängig davon, ob es sich um ZIP oder rar handelt. Aber das Problem, das ich Laufzeitfehler erhalte, bevor ich meine Datei validieren kann. Ich möchte benutzerdefinierte Benachrichtigung erstellen: < /p>
public class ZipValidator {
public void validate(Path pathToFile) throws IOException {
try {
ZipFile zipFile = new ZipFile(pathToFile.toFile());
String zipname = zipFile.getName();
} catch (InvalidZipException e) {
throw new InvalidZipException("Not a zip file");
}
}
}
< /code>
Im Moment habe ich Laufzeitfehler: < /p>
Java.util.zip.zipexception: Fehler in der Öffnen von ZIP -Datei < /p> < /> < /blockquote>
Wie identifiziere ich eine Zip -Datei in Java? ⇐ Java
-
- Similar Topics
- Replies
- Views
- Last post