package com.jenjinstudios.io.serialization;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.jenjinstudios.io.Message;
import com.jenjinstudios.io.MessageReader;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Implements a MessageWriter which relies on Gson to deserialize incoming data.
 *
 * @author Caleb Brinkman
 */
public class GsonMessageReader implements MessageReader
{
    private final InputStream inputStream;
    private final Object gsonMessageDeserializer = new GsonMessageDeserializer();

    /**
     * Construct a new GsonMessageReader that will read Messages from the given InputStream.
     *
     * @param inputStream The InputStream.
     */
    public GsonMessageReader(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    @Override
    public Message read() throws IOException {
        final String s = new DataInputStream(inputStream).readUTF();
        Gson gson = new GsonBuilder()
              .registerTypeAdapter(Message.class, gsonMessageDeserializer)
              .create();
        Message message;
        try {
            message = gson.fromJson(s, Message.class);
        } catch (JsonSyntaxException ex) {
            throw new IOException("Syntax error in message JSON", ex);
        } catch (JsonParseException ex) {
            throw new IOException("Unable to properly parse JSON data into Message object", ex);
        }
        return message;
    }

    @Override
    public void close() throws IOException {
        inputStream.close();
    }
}

@@ -554,16 +554,20 @@
 e final 
+Data
 InputStr
@@ -908,16 +908,36 @@
 tream = 
+new DataInputStream(
 inputStr
@@ -935,24 +935,25 @@
 (inputStream
+)
 ;%0A    %7D%0A%0A   
@@ -1035,36 +1035,16 @@
 ing s = 
-new DataInputStream(
 inputStr
@@ -1046,17 +1046,16 @@
 utStream
-)
 .readUTF

Change inputStream to DataInputStream