SteamWar/BauSystem2.0
Archiviert
12
0

Add gzip compression to trace data
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-04-18 16:19:23 +02:00
Ursprung 27dc30619b
Commit 33d687b216
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.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() {