Public feed
#526893
import java.io.*;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.GZIPInputStream;
public class RSUnpacker
{
public RSUnpacker()
{
}
public static final void main(String args[])
{
if(args.length < 2)
{
System.out.println("Usage: RSUnpacker [input] [output]");
System.out.println("Eg: RSUnpacker runescape.pack200 runescape.jar");
System.exit(2);
}
byte abyte0[] = readfile(args[0]);
byte abyte1[] = new byte[abyte0.length + 2];
abyte1[0] = 31;
abyte1[1] = -117;
System.arraycopy(abyte0, 0, abyte1, 2, abyte0.length);
try
{
FileOutputStream fileoutputstream = new FileOutputStream(args[1]);
JarOutputStream jaroutputstream = new JarOutputStream(fileoutputstream);
java.util.jar.Pack200.Unpacker unpacker = Pack200.newUnpacker();
unpacker.unpack(new GZIPInputStream(new ByteArrayInputStream(abyte1)), jaroutputstream);
jaroutputstream.close();
System.out.println((new StringBuilder()).append("Extracted ").append(args[0]).append(" to: ").append(args[1]).toString());
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
}
public static final byte[] readfile(String s)
{
File file = new File(s);
if(!file.exists())
{
return null;
}
byte abyte0[];
int i = (int)file.length();
abyte0 = new byte[i];
try {
DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
datainputstream.readFully(abyte0, 0, i);
datainputstream.close();
return abyte0;
} catch (Throwable throwable){
throwable.printStackTrace();
}
return null;
}
}