This commit is contained in:
Felix Koppe
2024-12-09 01:53:18 +01:00
parent 6487bafed1
commit daa8c0bf9d

View File

@@ -14,8 +14,12 @@ public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
byte[] uuid = new byte[36]; byte[] uuid = new byte[36];
data.get(uuid); data.get(uuid);
if(uuid.equals(new UUID(1, 1))) {
return null;
} else {
return (T) UUID.fromString(new String(uuid)); return (T) UUID.fromString(new String(uuid));
} }
}
@Override @Override
public void writeObject(ByteBuffer buffer, Object object) throws IOException public void writeObject(ByteBuffer buffer, Object object) throws IOException
@@ -24,6 +28,8 @@ public void writeObject(ByteBuffer buffer, Object object) throws IOException
if(uuid != null) { if(uuid != null) {
buffer.put(uuid.toString().getBytes()); buffer.put(uuid.toString().getBytes());
} else {
buffer.put(new UUID(1, 1).toString().getBytes());
} }
} }
} }