@Override
public IoBuffer encode() {
final int dataLen = this.data == null ? 0 : this.data.length;
final IoBuffer buffer =
IoBuffer.allocate(13 + ByteUtils.stringSize(this.partition) + ByteUtils.stringSize(dataLen)
+ ByteUtils.stringSize(this.getOpaque()) + this.getTopic().length()
+ ByteUtils.stringSize(this.msgId) + ByteUtils.stringSize(this.flag)
+ ByteUtils.stringSize(this.checkSum) + dataLen);
ByteUtils.setArguments(buffer, MetaEncodeCommand.SYNC_CMD, this.getTopic(), this.partition, dataLen, this.flag,
this.msgId, this.checkSum, this.getOpaque());
if (this.data != null) {
buffer.put(this.data);
}
buffer.flip();
return buffer;
}