All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.moaxcp.x11client.protocol.xproto.SetupAuthenticate Maven / Gradle / Ivy

There is a newer version: 0.18.2
Show newest version
package com.github.moaxcp.x11client.protocol.xproto;

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.Byte;
import java.lang.Override;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

@Value
@Builder
public class SetupAuthenticate implements XStruct {
  private byte status;

  @NonNull
  private List reason;

  public static SetupAuthenticate readSetupAuthenticate(X11Input in) throws IOException {
    byte status = in.readCard8();
    in.readPad(5);
    short length = in.readCard16();
    List reason = in.readChar(Short.toUnsignedInt(length) * 4);
    SetupAuthenticate.SetupAuthenticateBuilder javaBuilder = SetupAuthenticate.builder();
    javaBuilder.status(status);
    javaBuilder.reason(reason);
    return javaBuilder.build();
  }

  @Override
  public void write(X11Output out) throws IOException {
    out.writeCard8(status);
    out.writePad(5);
    short length = (short) reason.size();
    out.writeCard16(length);
    out.writeChar(reason);
  }

  @Override
  public int getSize() {
    return 8 + 1 * reason.size();
  }

  public static class SetupAuthenticateBuilder {
    public int getSize() {
      return 8 + 1 * reason.size();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy