AS1/2 better deobfuscation

code formatting
This commit is contained in:
Jindra Pet��k
2013-03-10 06:03:15 +01:00
parent 959a413a72
commit 4c1485808f
164 changed files with 1083 additions and 666 deletions
@@ -18,10 +18,15 @@ package com.jpexs.decompiler.flash.helpers;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class with helper method
@@ -273,4 +278,46 @@ public class Helper {
}
return ret;
}
public static ByteArrayInputStream getInputStream(byte[]... data) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
for (byte[] d : data) {
baos.write(d);
}
} catch (IOException iex) {
}
return new ByteArrayInputStream(baos.toByteArray());
}
public static byte[] readFile(String... file) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (String f : file) {
try {
FileInputStream fis = new FileInputStream(f);
byte buf[] = new byte[4096];
int cnt = 0;
while ((cnt = fis.read(buf)) > 0) {
baos.write(buf, 0, cnt);
}
fis.close();
} catch (IOException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
}
}
return baos.toByteArray();
}
public static void writeFile(String file, byte[]... data) {
try {
FileOutputStream fos = new FileOutputStream(file);
for (byte d[] : data) {
fos.write(d);
}
fos.close();
} catch (Exception ex) {
}
}
}