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

it.auties.whatsapp.model.sync.MutationsSyncSpec Maven / Gradle / Ivy

package it.auties.whatsapp.model.sync;

import it.auties.whatsapp.model.sync.MutationsSync;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;

public class MutationsSyncSpec {
    public static byte[] encode(MutationsSync protoInputObject) {
      if(protoInputObject == null) {
         return null;
      }
      var outputStream = new ProtobufOutputStream();
      if(protoInputObject.mutations() != null) {
       for(var mutationsEntry : protoInputObject.mutations()) {
outputStream.writeBytes(1, it.auties.whatsapp.model.sync.MutationSyncSpec.encode(mutationsEntry));
       }
      }
      return outputStream.toByteArray();
    }

    public static MutationsSync decode(byte[] input) {
        if(input == null) {
            return null;
        }
        var inputStream = new ProtobufInputStream(input);
        java.util.List mutations = new java.util.ArrayList();
        while(inputStream.readTag()) {
            switch(inputStream.index()) {
                case 1 -> mutations.add(it.auties.whatsapp.model.sync.MutationSyncSpec.decode(inputStream.readBytes()));
                default -> inputStream.skipBytes();
            }
        }
        return new it.auties.whatsapp.model.sync.MutationsSync(mutations);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy