mirror of
https://github.com/sirjonasxx/G-Wasm.git
synced 2024-11-22 16:30:51 +01:00
gzip inputstream & outputstream
This commit is contained in:
parent
3dc8779cf7
commit
c033057548
@ -17,6 +17,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class GWasm {
|
||||
|
||||
@ -52,9 +54,9 @@ public class GWasm {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, InvalidOpCodeException {
|
||||
|
||||
//
|
||||
long start = System.currentTimeMillis();
|
||||
Module module = new Module("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.6.0_(7)\\habbo2020-global-prod.wasm.code.unityweb");
|
||||
Module module = new Module("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.23.0_(534)\\habbo2020-global-prod.wasm.gz", true);
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Assembly time: " + (end - start));
|
||||
@ -73,7 +75,7 @@ public class GWasm {
|
||||
// ));
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
module.assembleToFile("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.6.0_(7)\\out\\habbo2020-global-prod.wasm.code.unityweb");
|
||||
module.assembleToFile("C:\\Users\\jonas\\Desktop\\Projects\\Jznnp\\S\\habbo2020\\rawfiles\\0.23.0_(534)\\out\\habbo2020-global-prod.wasm.gz", true);
|
||||
end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Disassembly time: " + (end - start));
|
||||
|
@ -21,6 +21,8 @@ import wasm.disassembly.modules.sections.type.TypeSection;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class Module extends WASMOpCode {
|
||||
|
||||
@ -75,8 +77,12 @@ public class Module extends WASMOpCode {
|
||||
in.close();
|
||||
}
|
||||
|
||||
public Module(String fileName) throws IOException, InvalidOpCodeException {
|
||||
this(new BufferedInputStream(new FileInputStream(new File(fileName))));
|
||||
public Module(String fileName, boolean gzip) throws IOException, InvalidOpCodeException {
|
||||
this(new BufferedInputStream(
|
||||
gzip ?
|
||||
new GZIPInputStream(new FileInputStream(new File(fileName))) :
|
||||
new FileInputStream(new File(fileName))
|
||||
));
|
||||
}
|
||||
|
||||
public Module(Magic magic, Version version, TypeSection typeSection, ImportSection importSection, FunctionSection functionSection, TableSection tableSection, MemorySection memorySection, GlobalSection globalSection, ExportSection exportSection, StartSection startSection, ElementSection elementSection, CodeSection codeSection, DataSection dataSection) {
|
||||
@ -148,8 +154,8 @@ public class Module extends WASMOpCode {
|
||||
}
|
||||
}
|
||||
|
||||
public void assembleToFile(String fileName) throws IOException, InvalidOpCodeException {
|
||||
FileOutputStream habAssembled = new FileOutputStream(fileName);
|
||||
public void assembleToFile(String fileName, boolean gzip) throws IOException, InvalidOpCodeException {
|
||||
OutputStream habAssembled = gzip ? new GZIPOutputStream(new FileOutputStream(fileName)) : new FileOutputStream(fileName);
|
||||
assemble(habAssembled);
|
||||
habAssembled.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user