示例#1
0
  public HornetQBuffer encode(final RemotingConnection connection) {
    HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);

    // The standard header fields

    buffer.writeInt(0); // The length gets filled in at the end
    buffer.writeByte(type);
    buffer.writeLong(channelID);

    encodeRest(buffer);

    size = buffer.writerIndex();

    // The length doesn't include the actual length byte
    int len = size - DataConstants.SIZE_INT;

    buffer.setInt(0, len);

    return buffer;
  }
 @Override
 public void encodeRest(HornetQBuffer buffer) {
   super.encodeRest(buffer);
   buffer.writeSimpleString(handler);
   vote.encode(buffer);
 }