@Override public byte[] encode() { final ByteBuffer buffer = ByteBuffer.allocate(5 + this.m_action.serializedSize()); buffer.putInt(this.m_compartmentId); buffer.put((byte) this.m_action.getType().ordinal()); this.m_action.serializeIn(buffer); return this.addClientHeader((byte) 3, buffer.array()); }
@Override public byte[] encode() { final ByteBuffer bb = ByteBuffer.allocate(12 + this.m_action.serializedSize()); bb.putInt(this.m_action.getId()); bb.putLong(this.m_itemId); this.m_action.serialize(bb); return this.addClientHeader((byte) 3, bb.array()); }
@Override public byte[] encode() { final byte[] name = StringUtils.toUTF8(this.m_inviterName); final byte[] groupName = StringUtils.toUTF8(this.m_groupName); final int sizeDatas = 3 + name.length + 1 + groupName.length + 8; final ByteBuffer buffer = ByteBuffer.allocate(sizeDatas); buffer.put(this.m_groupType); buffer.put((byte) (this.m_invitationAccepted ? 1 : 0)); buffer.put((byte) name.length); buffer.put(name); buffer.put((byte) groupName.length); buffer.put(groupName); buffer.putLong(this.m_inviterId); if (this.m_sendToGlobalServer) { return this.addClientHeader((byte) 6, buffer.array()); } return this.addClientHeader((byte) 2, buffer.array()); }