com.github.moaxcp.x11.protocol.xkb.SIAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-protocol-xkb Show documentation
Show all versions of x11-protocol-xkb Show documentation
An implementation of the x11 xkb protocol in java
The newest version!
package com.github.moaxcp.x11.protocol.xkb;
import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.X11Output;
import com.github.moaxcp.x11.protocol.XStruct;
import java.io.IOException;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@Value
@Builder
public class SIAction implements XStruct {
public static final String PLUGIN_NAME = "xkb";
private byte type;
@NonNull
private List data;
public static SIAction readSIAction(X11Input in) throws IOException {
SIAction.SIActionBuilder javaBuilder = SIAction.builder();
byte type = in.readCard8();
List data = in.readCard8(7);
javaBuilder.type(type);
javaBuilder.data(data);
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
out.writeCard8(type);
out.writeCard8(data);
}
@Override
public int getSize() {
return 1 + 1 * data.size();
}
public String getPluginName() {
return PLUGIN_NAME;
}
public static class SIActionBuilder {
public SIAction.SIActionBuilder type(SAType type) {
this.type = (byte) type.getValue();
return this;
}
public SIAction.SIActionBuilder type(byte type) {
this.type = type;
return this;
}
public int getSize() {
return 1 + 1 * data.size();
}
}
}