@Override public void build(DataBuffer buffer) { // buffer.putShort(((color & 0xFF) << 8) + (effect & 0xFF)); buffer.put(color); buffer.put(effect); buffer.put(rights); byte[] data = compress(message); buffer.put(data.length); buffer.putReverse(data); }
@Override public void parse(DataBuffer buffer) { this.effect = buffer.get(); this.color = buffer.get(); this.message = decompress(buffer.getReverse(buffer.remaining())); }