public void Encode(ByteBuffer buffer, object value)
 {
     byte[] byteBuf = (byte[])value;
     buffer.WriteInt(byteBuf.Length);
     buffer.WriteBytes(byteBuf);
 }
 public void Encode(ByteBuffer buffer, object value)
 {
     string str = (string)value;
     buffer.WriteString(str);
 }
 public object Decode(ByteBuffer buffer)
 {
     byte[] bytes = new byte[buffer.ReadInt()];
     buffer.ReadBytes(bytes, 0, bytes.Length);
     return bytes;
 }
 public object Decode(ByteBuffer buffer)
 {
     return buffer.ReadString();
 }