SteamWar/BauSystem2.0
Archiviert
12
0

Trace Refactor #233

Zusammengeführt
YoyoNow hat 121 Commits von TracerGUI nach master 2024-04-21 16:03:26 +02:00 zusammengeführt
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
Nur Änderungen aus Commit 33d687b216 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -35,6 +35,7 @@ import java.io.*;
import java.lang.ref.SoftReference;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.GZIPInputStream;
public class Trace {
/**
@ -270,11 +271,10 @@ public class Trace {
private void loadRecords() {
List<TNTPoint> records = new ArrayList<>();
@Cleanup
FileInputStream fileInputStream = new FileInputStream(recordsSaveFile);
@Cleanup
ObjectInputStream inputStream = new ObjectInputStream(fileInputStream);
ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(fileInputStream));
while (fileInputStream.getChannel().position() < recordsSaveFile.length()) {
records.add((TNTPoint) inputStream.readObject());
}

Datei anzeigen

@ -30,10 +30,11 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPOutputStream;
//TODO Rename ?
public class TraceRecordingWrapper {
private final Region region;
@Getter
private final long startTick;
private final List<TNTPoint> recordsToAdd;
@ -48,7 +49,6 @@ public class TraceRecordingWrapper {
@SneakyThrows
public TraceRecordingWrapper(Region region) {
this.region = region;
startTick = TPSUtils.currentTick.get();
recordsToAdd = new ArrayList<>();
recordList = new ArrayList<>();
@ -56,7 +56,7 @@ public class TraceRecordingWrapper {
trace = new Trace(region, recordList);
TraceManager.instance.add(trace);
File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records");
recordsOutputStream = new ObjectOutputStream(new FileOutputStream(recordsSaveFile));
recordsOutputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(recordsSaveFile)));
}
public int getNextOpenRecordIdAndIncrement() {