Move isValidZipFile to ZipHelper
This commit is contained in:
parent
ea91a62c89
commit
19cd3a17df
3 changed files with 11 additions and 11 deletions
|
|
@ -4,7 +4,9 @@ import java.io.BufferedInputStream;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
|
@ -99,4 +101,12 @@ public final class ZipHelper {
|
|||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidZipFile(final String filePath) {
|
||||
try (ZipFile ignored = new ZipFile(filePath)) {
|
||||
return true;
|
||||
} catch (final IOException ioe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue