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

it.auties.whatsapp.model.action.AndroidUnsupportedActionsSpec Maven / Gradle / Ivy

package it.auties.whatsapp.model.action;

import it.auties.whatsapp.model.action.AndroidUnsupportedActions;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;

public class AndroidUnsupportedActionsSpec {
    public static byte[] encode(AndroidUnsupportedActions protoInputObject) {
      if(protoInputObject == null) {
         return null;
      }
      var outputStream = new ProtobufOutputStream();
outputStream.writeBool(1, protoInputObject.allowed());
      return outputStream.toByteArray();
    }

    public static AndroidUnsupportedActions decode(byte[] input) {
        if(input == null) {
            return null;
        }
        var inputStream = new ProtobufInputStream(input);
        boolean allowed = false;
        while(inputStream.readTag()) {
            switch(inputStream.index()) {
                case 1 -> allowed = inputStream.readBool();
                default -> inputStream.skipBytes();
            }
        }
        return new it.auties.whatsapp.model.action.AndroidUnsupportedActions(allowed);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy