package com.jotuntech.sketcher.server.command; import java.nio.ByteBuffer; import com.jotuntech.sketcher.server.Command; import com.jotuntech.sketcher.server.Connection; import com.jotuntech.sketcher.server.Server; public class LayerDataCommand implements Command { int layerKey; boolean phantom; byte[] data; public LayerDataCommand() { } public LayerDataCommand(int layerKey, boolean phantom, byte[] data) { this.layerKey = layerKey; this.phantom = phantom; this.data = data; } public int perform(Server server, Connection connection) { /** Not implemented on server */ return Connection.SEND_NONE; } public void decode(ByteBuffer in) { layerKey = in.getInt(); phantom = in.get() != 0; data = new byte[in.remaining()]; in.get(data); } public void encode(ByteBuffer out) { out.putInt(layerKey); out.put((byte) (phantom ? 0xFF : 0x00)); out.put(data); } }