SteamWar/BauSystem2.0
Archiviert
12
0

Merge branch 'TracerGUI' of https://steamwar.de/devlabs/SteamWar/BauSystem2.0 into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-04-18 16:48:48 +02:00
Commit 1a3850600c
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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