From 9815450b83710d69736e903ccaa395ed565b7c76 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Fri, 22 Sep 2023 09:13:11 -0400 Subject: [PATCH] Remove unused imports, add string support. --- src/main/java/com/andrewlalis/record_net/IOUtil.java | 1 - .../andrewlalis/record_net/RecordMappedSerializer.java | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/andrewlalis/record_net/IOUtil.java b/src/main/java/com/andrewlalis/record_net/IOUtil.java index 6d43513..d7f3a10 100644 --- a/src/main/java/com/andrewlalis/record_net/IOUtil.java +++ b/src/main/java/com/andrewlalis/record_net/IOUtil.java @@ -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; /** diff --git a/src/main/java/com/andrewlalis/record_net/RecordMappedSerializer.java b/src/main/java/com/andrewlalis/record_net/RecordMappedSerializer.java index b40917c..a550045 100644 --- a/src/main/java/com/andrewlalis/record_net/RecordMappedSerializer.java +++ b/src/main/java/com/andrewlalis/record_net/RecordMappedSerializer.java @@ -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); } } }