mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 03:00:51 +00:00
do not copy big byte arrays, store only references (ByteArrayRange) e.g in image tags
This commit is contained in:
@@ -71,8 +71,6 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable {
|
||||
writeToFile(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FileTextWriter append(String str, long offset) {
|
||||
|
||||
+1
-1
@@ -28,6 +28,6 @@ public class GraphSourceItemPosition {
|
||||
|
||||
public GraphSourceItem graphSourceItem;
|
||||
public int position;
|
||||
public Map<String,String> data;
|
||||
public Map<String, String> data;
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class GraphTextWriter {
|
||||
* @param data
|
||||
* @return GraphTextWriter
|
||||
*/
|
||||
public GraphTextWriter startOffset(GraphSourceItem src, int pos, Map<String,String> data) {
|
||||
public GraphTextWriter startOffset(GraphSourceItem src, int pos, Map<String, String> data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -105,21 +105,20 @@ public abstract class GraphTextWriter {
|
||||
public GraphTextWriter hilightSpecial(String text, String type) {
|
||||
return hilightSpecial(text, type, "0");
|
||||
}
|
||||
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, int index) {
|
||||
return hilightSpecial(text, type, ""+index);
|
||||
return hilightSpecial(text, type, "" + index);
|
||||
}
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, String index) {
|
||||
return hilightSpecial(text, type, "0", new HashMap<String, String>());
|
||||
}
|
||||
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, int index, Map<String,String> data) {
|
||||
return hilightSpecial(text, type, ""+index, data);
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, int index, Map<String, String> data) {
|
||||
return hilightSpecial(text, type, "" + index, data);
|
||||
}
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, String index, Map<String,String> data) {
|
||||
|
||||
public GraphTextWriter hilightSpecial(String text, String type, String index, Map<String, String> data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -127,8 +126,8 @@ public abstract class GraphTextWriter {
|
||||
return "";
|
||||
}
|
||||
|
||||
public abstract GraphTextWriter appendWithData(String str, Map<String,String> data);
|
||||
|
||||
public abstract GraphTextWriter appendWithData(String str, Map<String, String> data);
|
||||
|
||||
public abstract GraphTextWriter append(String str);
|
||||
|
||||
public abstract GraphTextWriter append(String str, long offset);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class HilightedTextWriter extends GraphTextWriter {
|
||||
* @return HilightedTextWriter
|
||||
*/
|
||||
@Override
|
||||
public HilightedTextWriter startOffset(GraphSourceItem src, int pos, Map<String,String> data) {
|
||||
public HilightedTextWriter startOffset(GraphSourceItem src, int pos, Map<String, String> data) {
|
||||
GraphSourceItemPosition itemPos = new GraphSourceItemPosition();
|
||||
itemPos.graphSourceItem = src;
|
||||
itemPos.position = pos;
|
||||
@@ -157,30 +157,26 @@ public class HilightedTextWriter extends GraphTextWriter {
|
||||
Map<String, String> ndata = new HashMap<>();
|
||||
ndata.putAll(data);
|
||||
ndata.put("subtype", type);
|
||||
ndata.put("index", index);
|
||||
ndata.put("index", index);
|
||||
start(ndata, HilightType.SPECIAL);
|
||||
appendNoHilight(text);
|
||||
return end(HilightType.SPECIAL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HilightedTextWriter append(String str) {
|
||||
return appendWithData(str, new HashMap<String, String>());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HilightedTextWriter appendWithData(String str, Map<String,String> data) {
|
||||
public HilightedTextWriter appendWithData(String str, Map<String, String> data) {
|
||||
Highlighting h = null;
|
||||
if (!offsets.empty()) {
|
||||
GraphSourceItemPosition itemPos = offsets.peek();
|
||||
GraphSourceItem src = itemPos.graphSourceItem;
|
||||
int pos = itemPos.position;
|
||||
if (src != null && hilight) {
|
||||
Map<String,String> ndata=new HashMap<>();
|
||||
Map<String, String> ndata = new HashMap<>();
|
||||
ndata.putAll(itemPos.data);
|
||||
ndata.putAll(data);
|
||||
ndata.put("offset", Long.toString(src.getOffset() + pos + 1));
|
||||
|
||||
@@ -109,8 +109,6 @@ public class NulWriter extends GraphTextWriter {
|
||||
stringAdded = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public NulWriter append(String str) {
|
||||
@@ -123,8 +121,6 @@ public class NulWriter extends GraphTextWriter {
|
||||
stringAdded = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public NulWriter append(String str, long offset) {
|
||||
|
||||
@@ -59,8 +59,6 @@ public class Highlighting implements Serializable {
|
||||
return new HashMap<>(properties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getPropertyString(String key) {
|
||||
return properties.get(key);
|
||||
}
|
||||
@@ -72,27 +70,29 @@ public class Highlighting implements Serializable {
|
||||
public static Highlighting search(List<Highlighting> list, String property, String value) {
|
||||
return search(list, -1, property, value, -1, -1);
|
||||
}
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, Map<String,String> properties) {
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, Map<String, String> properties) {
|
||||
return search(list, -1, properties, -1, -1);
|
||||
}
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, String property, String value, int from, int to) {
|
||||
return search(list, -1, property, value, from, to);
|
||||
}
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, Map<String,String> properties, int from, int to) {
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, Map<String, String> properties, int from, int to) {
|
||||
return search(list, -1, properties, from, to);
|
||||
}
|
||||
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, long pos, String property, String value, long from, long to) {
|
||||
Map<String,String> map= new HashMap<>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(property, value);
|
||||
return search(list, pos, map, from, to);
|
||||
}
|
||||
public static Highlighting search(List<Highlighting> list, long pos, Map<String,String> properties, long from, long to) {
|
||||
|
||||
public static Highlighting search(List<Highlighting> list, long pos, Map<String, String> properties, long from, long to) {
|
||||
Highlighting ret = null;
|
||||
looph:for (Highlighting h : list) {
|
||||
looph:
|
||||
for (Highlighting h : list) {
|
||||
if (from > -1) {
|
||||
if (h.startPos < from) {
|
||||
continue;
|
||||
@@ -103,7 +103,7 @@ public class Highlighting implements Serializable {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for(String property:properties.keySet()){
|
||||
for (String property : properties.keySet()) {
|
||||
if (property != null) {
|
||||
String v = h.getPropertyString(property);
|
||||
String value = properties.get(property);
|
||||
@@ -118,7 +118,7 @@ public class Highlighting implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pos == -1 || (pos >= h.startPos && (pos < h.startPos + h.len))) {
|
||||
if (ret == null || h.startPos > ret.startPos) { //get the closest one
|
||||
ret = h;
|
||||
@@ -163,13 +163,13 @@ public class Highlighting implements Serializable {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (pos == -1 ||(pos >= h.startPos && (pos < h.startPos + h.len))) {
|
||||
if (pos == -1 || (pos >= h.startPos && (pos < h.startPos + h.len))) {
|
||||
//if (ret == null || h.startPos > ret.startPos) { //get the closest one
|
||||
ret.add(h);
|
||||
ret.add(h);
|
||||
//}
|
||||
}
|
||||
//if (pos == -1) {
|
||||
// return ret;
|
||||
// return ret;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user