@@ -0,0 +1,1830 @@
+package com.coderdojo.libretalk;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.ObjectInputStream;%0Aimport java.io.ObjectOutputStream;%0Aimport java.io.Serializable;%0Aimport java.io.StreamCorruptedException;%0A%0Aimport android.graphics.Color;%0A%0Apublic final class LibretalkMessageData implements Serializable%0A%7B%0A%09/**%0A%09 *  %5B!%5D AUTO GENERATED DO NOT MODIFY %0A%09 */%0A%09private static final long serialVersionUID = 2649285673568863822L;%0A%09%0A%09%0A%09private final String data;%0A%09private final String userTag;%0A%09private final int color;%0A%09%0A%09public LibretalkMessageData(final String username, final String message)%0A%09%7B%0A%09%09this.userTag = username;%0A%09%09this.data = message;%0A%09%09this.color = getColorFromString(username);%0A%09%7D%0A%09%0A%09private static final int getColorFromString(final String s)%0A%09%7B%0A%09%09final int c = s.hashCode();%0A%09%09%0A%09%09final int r = (c %3C%3C 16) & 0xFF; %0A%09%09final int g = (c %3C%3C 8)  & 0xFF;%0A%09%09final int b = c & 0xFF;%0A%09%09%0A%09%09return Color.rgb(r, g, b);%0A%09%7D%0A%09%0A%0A%09public String getUserTag()%0A%09%7B%0A%09%09return userTag;%0A%09%7D%0A%0A%09public int getColor()%0A%09%7B%0A%09%09return color;%0A%09%7D%0A%0A%09public String getData()%0A%09%7B%0A%09%09return data;%0A%09%7D%0A%0A%09%0A%09public static final byte%5B%5D serialize(final LibretalkMessageData o) throws IOException%0A%09%7B%0A%09%09final ByteArrayOutputStream out = new ByteArrayOutputStream();%0A%09%09final ObjectOutputStream objOut = new ObjectOutputStream(out);%0A%09%09%0A%09%09objOut.writeObject(o);%0A%09%09return out.toByteArray();%09%09%0A%09%7D%0A%09%0A%09public static final LibretalkMessageData deserialize(final byte%5B%5D data) throws %0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09StreamCorruptedException, %0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09IOException, %0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09ClassNotFoundException%0A%09%7B%0A%09%09final ByteArrayInputStream input = new ByteArrayInputStream(data);%0A%09%09final ObjectInputStream objInput = new ObjectInputStream(input);%0A%09%09%0A%09%09return (LibretalkMessageData) objInput.readObject();%0A%09%09%0A%09%7D%0A%09%0A%7D%0A

Add test storage class