-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_tmp_unpack_run.java
More file actions
16 lines (15 loc) · 837 Bytes
/
Copy path_tmp_unpack_run.java
File metadata and controls
16 lines (15 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.nio.file.*;
import com.runescape.cache.bzip.BZip2Decompressor;
public class UnpackRun {
public static void main(String[] args) throws Exception {
byte[] input = Files.readAllBytes(Path.of(args[0]));
int compressedLen = ((input[1] & 0xFF) << 24) | ((input[2] & 0xFF) << 16) | ((input[3] & 0xFF) << 8) | (input[4] & 0xFF);
int outputLen = ((input[5] & 0xFF) << 24) | ((input[6] & 0xFF) << 16) | ((input[7] & 0xFF) << 8) | (input[8] & 0xFF);
byte[] compressed = new byte[compressedLen];
System.arraycopy(input, 9, compressed, 0, compressedLen);
byte[] output = new byte[outputLen];
BZip2Decompressor.decompress(output, outputLen, compressed, compressedLen, 0);
Files.write(Path.of(args[1]), output);
System.out.println("ok " + output.length);
}
}