MCPcopy Create free account
hub / github.com/FongMi/CatVodSpider / unzip

Method unzip

app/src/main/java/com/github/catvod/utils/FileUtil.java:26–38  ·  view source on GitHub ↗
(File target, File path)

Source from the content-addressed store, hash-verified

24 }
25
26 public static void unzip(File target, File path) {
27 try (ZipFile zip = new ZipFile(target.getAbsolutePath())) {
28 Enumeration<?> entries = zip.entries();
29 while (entries.hasMoreElements()) {
30 ZipEntry entry = (ZipEntry) entries.nextElement();
31 File out = new File(path, entry.getName());
32 if (entry.isDirectory()) out.mkdirs();
33 else Path.copy(zip.getInputStream(entry), out);
34 }
35 } catch (Exception e) {
36 e.printStackTrace();
37 }
38 }
39
40 private static Uri getShareUri(File file) {
41 return Build.VERSION.SDK_INT < Build.VERSION_CODES.N ? Uri.fromFile(file) : FileProvider.getUriForFile(Init.context(), Init.context().getPackageName() + ".provider", file);

Callers 1

actionMethod · 0.95

Calls 2

copyMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected