Changed trace record output to data output/input instead of object output/input

This commit is contained in:
D4rkr34lm
2024-08-18 12:23:05 +02:00
parent 3e6dd61428
commit 67d4f3432a
@@ -64,7 +64,7 @@ public class TraceRepository {
@SneakyThrows
protected static void writeTraceRecords(File recordsFile, List<TNTPoint> records) {
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(recordsFile));
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(recordsFile));
for (TNTPoint record : records) {
outputStream.writeInt(record.getTntId());
outputStream.writeBoolean(record.isExplosion());
@@ -88,7 +88,7 @@ public class TraceRepository {
}
@SneakyThrows
protected static TNTPoint readTraceRecord(ObjectInputStream objectInput) {
protected static TNTPoint readTraceRecord(DataInputStream objectInput) {
int tntId = objectInput.readInt();
boolean explosion = objectInput.readBoolean();
@@ -116,7 +116,7 @@ public class TraceRepository {
protected static List<TNTPoint> readTraceRecords(Trace trace) {
File recordsFile = trace.getRecordsSaveFile();
@Cleanup
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(recordsFile));
DataInputStream inputStream = new DataInputStream(new FileInputStream(recordsFile));
List<TNTPoint> records = new ArrayList<>();
for (int i = 0; i < trace.getRecordsCount(); i++) {