do not copy big byte arrays, store only references (ByteArrayRange) e.g in image tags

This commit is contained in:
2014-11-09 22:40:36 +01:00
parent 270cc40856
commit 3456d04d38
151 changed files with 2787 additions and 2512 deletions
@@ -23,7 +23,7 @@ package com.jpexs.helpers;
public class ByteArrayRange {
public static final ByteArrayRange EMPTY = new ByteArrayRange(new byte[0]);
private final byte[] array;
private final int pos;
private final int length;
@@ -43,18 +43,28 @@ public class ByteArrayRange {
public byte[] getArray() {
return array;
}
public int getPos() {
return pos;
}
public int getLength() {
return length;
}
public byte get(int index) {
return array[pos + index];
}
public byte[] getRangeData() {
byte[] data = new byte[length];
System.arraycopy(array, pos, data, 0, length);
return data;
}
public byte[] getRangeData(int pos, int length) {
byte[] data = new byte[length];
System.arraycopy(array, this.pos + pos, data, 0, length);
return data;
}
}
@@ -61,7 +61,6 @@ public class Helper {
public static String newLine = System.getProperty("line.separator");
public static String decompilationErrorAdd = null;
/**
* Converts array of int values to string
*
@@ -809,7 +808,7 @@ public class Helper {
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.obfuscated")).newLine();
if(decompilationErrorAdd!=null){
if (decompilationErrorAdd != null) {
writer.appendNoHilight(" * ").appendNoHilight(decompilationErrorAdd).newLine();
}
writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.errorType")).