it.auties.whatsapp.model.action.RecentEmojiWeightsActionSpec Maven / Gradle / Ivy
package it.auties.whatsapp.model.action;
import it.auties.whatsapp.model.action.RecentEmojiWeightsAction;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;
public class RecentEmojiWeightsActionSpec {
public static byte[] encode(RecentEmojiWeightsAction protoInputObject) {
if(protoInputObject == null) {
return null;
}
var outputStream = new ProtobufOutputStream();
if(protoInputObject.weights() != null) {
for(var weightsEntry : protoInputObject.weights()) {
outputStream.writeBytes(1, it.auties.whatsapp.model.sync.RecentEmojiWeightSpec.encode(weightsEntry));
}
}
return outputStream.toByteArray();
}
public static RecentEmojiWeightsAction decode(byte[] input) {
if(input == null) {
return null;
}
var inputStream = new ProtobufInputStream(input);
java.util.List weights = new java.util.ArrayList();
while(inputStream.readTag()) {
switch(inputStream.index()) {
case 1 -> weights.add(it.auties.whatsapp.model.sync.RecentEmojiWeightSpec.decode(inputStream.readBytes()));
default -> inputStream.skipBytes();
}
}
return new it.auties.whatsapp.model.action.RecentEmojiWeightsAction(weights);
}
}