Removed some ziptool stuff

Well as it was removed from here, it may aswell just be removed from this file too :)
This commit is contained in:
Ryan 2013-07-07 23:39:02 +01:00
parent 5868540cbb
commit f63805cca2

View file

@ -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<File> queue = new LinkedList<File>();
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<? extends ZipEntry> 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
{