import java.io.UnsupportedEncodingException;

public class Message
{
   public static final byte Server = 0;
   public static final byte Text = 1;
   public static final byte Draw = 2;
   private byte type;
   private byte [] data;
   

   public Message( byte _type, String dat )
   {
      type = _type;
      int length = dat.length();
      data = new byte[length];
      for(int index = 0; index < length; index++ )
         data[index] = (byte)dat.charAt(index);
   }

   public Message( byte _type, byte [] dat )
   {
      type = _type;
      data = dat;
   }

   public byte getType()
   {
      return type;
   }

   public byte[] getBytes()
   {
      return data;
   }
   public String toString()
   {
      return new String( data );
   }
}
