com.github.moaxcp.x11client.protocol.res.ClientIdValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-client Show documentation
Show all versions of x11-client Show documentation
An x11 client implemented in java
package com.github.moaxcp.x11client.protocol.res;
import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XStruct;
import java.io.IOException;
import java.lang.Integer;
import java.lang.Override;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@Value
@Builder
public class ClientIdValue implements XStruct {
@NonNull
private ClientIdSpec spec;
@NonNull
private List value;
public static ClientIdValue readClientIdValue(X11Input in) throws IOException {
ClientIdSpec spec = ClientIdSpec.readClientIdSpec(in);
int length = in.readCard32();
List value = in.readCard32((int) (Integer.toUnsignedLong(length) / 4));
ClientIdValue.ClientIdValueBuilder javaBuilder = ClientIdValue.builder();
javaBuilder.spec(spec);
javaBuilder.value(value);
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
spec.write(out);
int length = value.size();
out.writeCard32(length);
out.writeCard32(value);
}
@Override
public int getSize() {
return 12 + 4 * value.size();
}
public static class ClientIdValueBuilder {
public int getSize() {
return 12 + 4 * value.size();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy