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); } } }