pl.grzeslowski.jsupla.protocol.api.encoders.cs.ActionWithAuthEncoder Maven / Gradle / Ivy
package pl.grzeslowski.jsupla.protocol.api.encoders.cs;
import lombok.val;
import pl.grzeslowski.jsupla.protocol.api.encoders.PrimitiveEncoder;
import pl.grzeslowski.jsupla.protocol.api.structs.cs.ActionWithAuth;
import static pl.grzeslowski.jsupla.protocol.api.JavaConsts.*;
import static pl.grzeslowski.jsupla.protocol.api.consts.ProtoConsts.*;
@javax.annotation.Generated(value="Struct original name: TCS_ActionWithAuth", date = "2024-08-03T11:49:42.037Z[Etc/UTC]")
@lombok.NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class ActionWithAuthEncoder implements pl.grzeslowski.jsupla.protocol.api.encoders.cs.ClientServerEncoder {
public static final ActionWithAuthEncoder INSTANCE = new ActionWithAuthEncoder();
@Override
public byte[] encode(ActionWithAuth proto) {
final byte[] bytes = new byte[proto.size()];
int offset = 0;
byte[] authBytes = pl.grzeslowski.jsupla.protocol.api.encoders.cs.ClientAuthorizationDetailsEncoder.INSTANCE.encode(proto.auth);
offset += authBytes.length;
byte[] actionBytes = pl.grzeslowski.jsupla.protocol.api.encoders.cs.ActionEncoder.INSTANCE.encode(proto.action);
offset += actionBytes.length;
return bytes;
}
}