Beispiel #1
0
 @Override
 public ChannelBuffer encode(CommandMessage message) {
   ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
   buffer.writeInt(message.getCommand());
   ChannelBufferUtils.writeCommandArguments(buffer, message.getArguments());
   return buffer;
 }
Beispiel #2
0
 @Override
 public CommandMessage decode(ChannelBuffer buffer) {
   final int command = buffer.readInt();
   final List<Object> arguments = ChannelBufferUtils.readCommandArguments(buffer);
   return new CommandMessage(command, arguments);
 }