From f63805cca2942d7d21ac22056cfac50f9ae0590c Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 7 Jul 2013 23:39:02 +0100 Subject: [PATCH] Removed some ziptool stuff Well as it was removed from here, it may aswell just be removed from this file too :) --- .../TotalFreedomMod/TFM_Util.java | 71 +------------------ 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index 0a3e60ec..9ac1bd3f 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -305,76 +305,7 @@ public class TFM_Util return TFM_Util.mobtypes.get(mobname); } - public static void zip(File directory, File zipfile, boolean verbose, CommandSender sender) throws IOException - { - URI base = directory.toURI(); - Deque queue = new LinkedList(); - queue.push(directory); - OutputStream out = new FileOutputStream(zipfile); - Closeable res = out; - try - { - ZipOutputStream zout = new ZipOutputStream(out); - res = zout; - while (!queue.isEmpty()) - { - directory = queue.pop(); - for (File kid : directory.listFiles()) - { - String name = base.relativize(kid.toURI()).getPath(); - if (kid.isDirectory()) - { - queue.push(kid); - name = name.endsWith("/") ? name : name + "/"; - zout.putNextEntry(new ZipEntry(name)); - } - else - { - zout.putNextEntry(new ZipEntry(name)); - copy(kid, zout); - zout.closeEntry(); - } - - if (verbose) - { - sender.sendMessage("Zipping: " + name); - } - } - } - } - finally - { - res.close(); - } - } - - public static void unzip(File zipfile, File directory) throws IOException - { - ZipFile zfile = new ZipFile(zipfile); - Enumeration entries = zfile.entries(); - while (entries.hasMoreElements()) - { - ZipEntry entry = entries.nextElement(); - File file = new File(directory, entry.getName()); - if (entry.isDirectory()) - { - file.mkdirs(); - } - else - { - file.getParentFile().mkdirs(); - InputStream in = zfile.getInputStream(entry); - try - { - copy(in, file); - } - finally - { - in.close(); - } - } - } - } + private static void copy(InputStream in, OutputStream out) throws IOException {