Remove unused imports, add string support.

This commit is contained in:
Andrew Lalis 2023-09-22 09:13:11 -04:00
parent 7890c2cd19
commit 9815450b83
2 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,6 @@ package com.andrewlalis.record_net;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.UUID;
/**

View File

@ -86,6 +86,9 @@ public class RecordMappedSerializer implements RecordSerializer {
if (type.equals(UUID.class)) {
return IOUtil.readUUID(dIn);
}
if (type.equals(String.class)) {
return IOUtil.readString(dIn);
}
if (type.isPrimitive()) {
return IOUtil.readPrimitive(type, dIn);
}
@ -127,8 +130,12 @@ public class RecordMappedSerializer implements RecordSerializer {
IOUtil.writeEnum((Enum<?>) obj, dOut);
} else if (type.equals(UUID.class)) {
IOUtil.writeUUID((UUID) obj, dOut);
} else {
} else if (type.equals(String.class)) {
IOUtil.writeString((String) obj, dOut);
} else if (type.isPrimitive()) {
IOUtil.writePrimitive(obj, dOut);
} else {
throw new UnsupportedMessageTypeException(type);
}
}
}