示例#1
0
 @Override
 public ChannelBuffer encode(LevelColorMessage message) throws IOException {
   ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
   ChannelBufferUtils.writeString(buffer, message.getType());
   buffer.writeInt(message.getValue());
   return buffer;
 }
示例#2
0
 @Override
 public LevelColorMessage decode(ChannelBuffer buffer) throws IOException {
   String type = ChannelBufferUtils.readString(buffer);
   int value = buffer.readInt();
   return new LevelColorMessage(type, value);
 }