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

com.github.moaxcp.x11client.protocol.xfixes.BadRegionError Maven / Gradle / Ivy

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

import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XError;
import java.io.IOException;
import java.lang.Override;
import lombok.Builder;
import lombok.Value;

@Value
@Builder
public class BadRegionError implements XError {
  public static final byte CODE = 0;

  private short sequenceNumber;

  private short minorOpcode;

  private byte majorOpcode;

  @Override
  public byte getCode() {
    return CODE;
  }

  public static BadRegionError readBadRegionError(X11Input in) throws IOException {
    short sequenceNumber = in.readCard16();
    short minorOpcode = in.readCard16();
    byte majorOpcode = in.readCard8();
    in.readPad(25);
    BadRegionError.BadRegionErrorBuilder javaBuilder = BadRegionError.builder();
    javaBuilder.sequenceNumber(sequenceNumber);
    javaBuilder.minorOpcode(minorOpcode);
    javaBuilder.majorOpcode(majorOpcode);
    return javaBuilder.build();
  }

  @Override
  public void write(X11Output out) throws IOException {
    out.writeCard8(getResponseCode());
    out.writeCard8(CODE);
    out.writeCard16(sequenceNumber);
    out.writeCard16(minorOpcode);
    out.writeCard8(majorOpcode);
    out.writePad(25);
  }

  @Override
  public int getSize() {
    return 32;
  }

  public static class BadRegionErrorBuilder {
    public int getSize() {
      return 32;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy