Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
it.auties.whatsapp.model.message.standard.ImageMessageSpec Maven / Gradle / Ivy
package it.auties.whatsapp.model.message.standard;
import it.auties.whatsapp.model.message.standard.ImageMessage;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;
import it.auties.protobuf.model.ProtobufWireType;
public class ImageMessageSpec {
public static byte[] encode(ImageMessage protoInputObject) {
if (protoInputObject == null) {
return null;
}
var outputStream = new ProtobufOutputStream(sizeOf(protoInputObject));
var mediaUrl = protoInputObject.mediaUrl();
if (mediaUrl != null) {
var mediaUrl0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaUrl);
if (mediaUrl0 != null) {
outputStream.writeString(1, mediaUrl0);
}
}
var mimetype = protoInputObject.mimetype();
if (mimetype != null) {
var mimetype0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mimetype);
if (mimetype0 != null) {
outputStream.writeString(2, mimetype0);
}
}
var caption = protoInputObject.caption();
if (caption != null) {
var caption0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(caption);
if (caption0 != null) {
outputStream.writeString(3, caption0);
}
}
var mediaSha256 = protoInputObject.mediaSha256();
if (mediaSha256 != null) {
var mediaSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaSha256);
if (mediaSha2560 != null) {
outputStream.writeBytes(4, mediaSha2560);
}
}
var mediaSize = protoInputObject.mediaSize();
if (mediaSize != null) {
var mediaSize0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableLong(mediaSize);
if (mediaSize0 != null) {
outputStream.writeUInt64(5, mediaSize0);
}
}
var height = protoInputObject.height();
if (height != null) {
var height0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(height);
if (height0 != null) {
outputStream.writeUInt32(6, height0);
}
}
var width = protoInputObject.width();
if (width != null) {
var width0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(width);
if (width0 != null) {
outputStream.writeUInt32(7, width0);
}
}
var mediaKey = protoInputObject.mediaKey();
if (mediaKey != null) {
var mediaKey0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaKey);
if (mediaKey0 != null) {
outputStream.writeBytes(8, mediaKey0);
}
}
var mediaEncryptedSha256 = protoInputObject.mediaEncryptedSha256();
if (mediaEncryptedSha256 != null) {
var mediaEncryptedSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaEncryptedSha256);
if (mediaEncryptedSha2560 != null) {
outputStream.writeBytes(9, mediaEncryptedSha2560);
}
}
if (protoInputObject.interactiveAnnotations() != null) {
for (var interactiveAnnotationsEntry : protoInputObject.interactiveAnnotations()) {
outputStream.writeBytes(10, it.auties.whatsapp.model.button.interactive.InteractiveLocationAnnotationSpec.encode(interactiveAnnotationsEntry));
}
}
var mediaDirectPath = protoInputObject.mediaDirectPath();
if (mediaDirectPath != null) {
var mediaDirectPath0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaDirectPath);
if (mediaDirectPath0 != null) {
outputStream.writeString(11, mediaDirectPath0);
}
}
var mediaKeyTimestampSeconds = protoInputObject.mediaKeyTimestampSeconds();
if (mediaKeyTimestampSeconds != null) {
var mediaKeyTimestampSeconds0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableLong(mediaKeyTimestampSeconds);
if (mediaKeyTimestampSeconds0 != null) {
outputStream.writeUInt64(12, mediaKeyTimestampSeconds0);
}
}
var thumbnail = protoInputObject.thumbnail();
if (thumbnail != null) {
var thumbnail0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnail);
if (thumbnail0 != null) {
outputStream.writeBytes(16, thumbnail0);
}
}
var contextInfo = protoInputObject.contextInfo();
if (contextInfo != null) {
var contextInfo0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(contextInfo);
if (contextInfo0 != null) {
outputStream.writeBytes(17, it.auties.whatsapp.model.info.ContextInfoSpec.encode(contextInfo0));
}
}
var firstScanSidecar = protoInputObject.firstScanSidecar();
if (firstScanSidecar != null) {
var firstScanSidecar0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(firstScanSidecar);
if (firstScanSidecar0 != null) {
outputStream.writeBytes(18, firstScanSidecar0);
}
}
var firstScanLength = protoInputObject.firstScanLength();
if (firstScanLength != null) {
var firstScanLength0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(firstScanLength);
if (firstScanLength0 != null) {
outputStream.writeUInt32(19, firstScanLength0);
}
}
var experimentGroupId = protoInputObject.experimentGroupId();
if (experimentGroupId != null) {
var experimentGroupId0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(experimentGroupId);
if (experimentGroupId0 != null) {
outputStream.writeUInt32(20, experimentGroupId0);
}
}
var scansSidecar = protoInputObject.scansSidecar();
if (scansSidecar != null) {
var scansSidecar0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(scansSidecar);
if (scansSidecar0 != null) {
outputStream.writeBytes(21, scansSidecar0);
}
}
if (protoInputObject.scanLengths() != null) {
for (var scanLengthsEntry : protoInputObject.scanLengths()) {
outputStream.writeUInt32(22, scanLengthsEntry);
}
}
var midQualityFileSha256 = protoInputObject.midQualityFileSha256();
if (midQualityFileSha256 != null) {
var midQualityFileSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(midQualityFileSha256);
if (midQualityFileSha2560 != null) {
outputStream.writeBytes(23, midQualityFileSha2560);
}
}
var midQualityFileEncSha256 = protoInputObject.midQualityFileEncSha256();
if (midQualityFileEncSha256 != null) {
var midQualityFileEncSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(midQualityFileEncSha256);
if (midQualityFileEncSha2560 != null) {
outputStream.writeBytes(24, midQualityFileEncSha2560);
}
}
outputStream.writeBool(25, protoInputObject.viewOnce());
var thumbnailDirectPath = protoInputObject.thumbnailDirectPath();
if (thumbnailDirectPath != null) {
var thumbnailDirectPath0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailDirectPath);
if (thumbnailDirectPath0 != null) {
outputStream.writeString(26, thumbnailDirectPath0);
}
}
var thumbnailSha256 = protoInputObject.thumbnailSha256();
if (thumbnailSha256 != null) {
var thumbnailSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailSha256);
if (thumbnailSha2560 != null) {
outputStream.writeBytes(27, thumbnailSha2560);
}
}
var thumbnailEncSha256 = protoInputObject.thumbnailEncSha256();
if (thumbnailEncSha256 != null) {
var thumbnailEncSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailEncSha256);
if (thumbnailEncSha2560 != null) {
outputStream.writeBytes(28, thumbnailEncSha2560);
}
}
var staticUrl = protoInputObject.staticUrl();
if (staticUrl != null) {
var staticUrl0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(staticUrl);
if (staticUrl0 != null) {
outputStream.writeString(29, staticUrl0);
}
}
return outputStream.toByteArray();
}
public static ImageMessage decode(byte[] input) {
if (input == null) {
return null;
}
return decode(new ProtobufInputStream(input, 0, input.length));
}
public static ImageMessage decode(ProtobufInputStream protoInputStream) {
java.lang.String mediaUrl = null;
java.lang.String mimetype = null;
java.lang.String caption = null;
byte[] mediaSha256 = null;
java.lang.Long mediaSize = null;
java.lang.Integer height = null;
java.lang.Integer width = null;
byte[] mediaKey = null;
byte[] mediaEncryptedSha256 = null;
java.util.List interactiveAnnotations = it.auties.protobuf.builtin.ProtobufRepeatedMixin.newList();
java.lang.String mediaDirectPath = null;
java.lang.Long mediaKeyTimestampSeconds = null;
byte[] thumbnail = null;
it.auties.whatsapp.model.info.ContextInfo contextInfo = null;
byte[] firstScanSidecar = null;
java.lang.Integer firstScanLength = null;
java.lang.Integer experimentGroupId = null;
byte[] scansSidecar = null;
java.util.List scanLengths = it.auties.protobuf.builtin.ProtobufRepeatedMixin.newList();
byte[] midQualityFileSha256 = null;
byte[] midQualityFileEncSha256 = null;
boolean viewOnce = false;
java.lang.String thumbnailDirectPath = null;
byte[] thumbnailSha256 = null;
byte[] thumbnailEncSha256 = null;
java.lang.String staticUrl = null;
while (protoInputStream.readTag()) {
var protoFieldIndex = protoInputStream.index();
switch (protoFieldIndex) {
case 1 -> mediaUrl = protoInputStream.readString();
case 2 -> mimetype = protoInputStream.readString();
case 3 -> caption = protoInputStream.readString();
case 4 -> mediaSha256 = protoInputStream.readBytes();
case 5 -> mediaSize = protoInputStream.readInt64();
case 6 -> height = protoInputStream.readInt32();
case 7 -> width = protoInputStream.readInt32();
case 8 -> mediaKey = protoInputStream.readBytes();
case 9 -> mediaEncryptedSha256 = protoInputStream.readBytes();
case 10 -> interactiveAnnotations.add(it.auties.whatsapp.model.button.interactive.InteractiveLocationAnnotationSpec.decode(protoInputStream.lengthDelimitedStream()));
case 11 -> mediaDirectPath = protoInputStream.readString();
case 12 -> mediaKeyTimestampSeconds = protoInputStream.readInt64();
case 16 -> thumbnail = protoInputStream.readBytes();
case 17 -> contextInfo = it.auties.whatsapp.model.info.ContextInfoSpec.decode(protoInputStream.lengthDelimitedStream());
case 18 -> firstScanSidecar = protoInputStream.readBytes();
case 19 -> firstScanLength = protoInputStream.readInt32();
case 20 -> experimentGroupId = protoInputStream.readInt32();
case 21 -> scansSidecar = protoInputStream.readBytes();
case 22 -> scanLengths.add(protoInputStream.readInt32());
case 23 -> midQualityFileSha256 = protoInputStream.readBytes();
case 24 -> midQualityFileEncSha256 = protoInputStream.readBytes();
case 25 -> viewOnce = protoInputStream.readBool();
case 26 -> thumbnailDirectPath = protoInputStream.readString();
case 27 -> thumbnailSha256 = protoInputStream.readBytes();
case 28 -> thumbnailEncSha256 = protoInputStream.readBytes();
case 29 -> staticUrl = protoInputStream.readString();
default -> protoInputStream.readUnknown(false);
}
}
return new it.auties.whatsapp.model.message.standard.ImageMessage(mediaUrl, mimetype, caption, mediaSha256, mediaSize, height, width, mediaKey, mediaEncryptedSha256, interactiveAnnotations, mediaDirectPath, mediaKeyTimestampSeconds, thumbnail, contextInfo, firstScanSidecar, firstScanLength, experimentGroupId, scansSidecar, scanLengths, midQualityFileSha256, midQualityFileEncSha256, viewOnce, thumbnailDirectPath, thumbnailSha256, thumbnailEncSha256, staticUrl);
}
public static int sizeOf(ImageMessage object) {
if (object == null) {
return 0;
}
var protoSize = 0;
var mediaUrl = object.mediaUrl();
if (mediaUrl != null) {
var mediaUrl0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaUrl);
if (mediaUrl0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(1, 2);
protoSize += ProtobufOutputStream.getStringSize(mediaUrl0);
}
}
var mimetype = object.mimetype();
if (mimetype != null) {
var mimetype0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mimetype);
if (mimetype0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(2, 2);
protoSize += ProtobufOutputStream.getStringSize(mimetype0);
}
}
var caption = object.caption();
if (caption != null) {
var caption0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(caption);
if (caption0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(3, 2);
protoSize += ProtobufOutputStream.getStringSize(caption0);
}
}
var mediaSha256 = object.mediaSha256();
if (mediaSha256 != null) {
var mediaSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaSha256);
if (mediaSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(4, 2);
protoSize += ProtobufOutputStream.getBytesSize(mediaSha2560);
}
}
var mediaSize = object.mediaSize();
if (mediaSize != null) {
var mediaSize0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableLong(mediaSize);
if (mediaSize0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(5, 0);
protoSize += ProtobufOutputStream.getVarIntSize(mediaSize0);
}
}
var height = object.height();
if (height != null) {
var height0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(height);
if (height0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(6, 0);
protoSize += ProtobufOutputStream.getVarIntSize(height0);
}
}
var width = object.width();
if (width != null) {
var width0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(width);
if (width0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(7, 0);
protoSize += ProtobufOutputStream.getVarIntSize(width0);
}
}
var mediaKey = object.mediaKey();
if (mediaKey != null) {
var mediaKey0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaKey);
if (mediaKey0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(8, 2);
protoSize += ProtobufOutputStream.getBytesSize(mediaKey0);
}
}
var mediaEncryptedSha256 = object.mediaEncryptedSha256();
if (mediaEncryptedSha256 != null) {
var mediaEncryptedSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaEncryptedSha256);
if (mediaEncryptedSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(9, 2);
protoSize += ProtobufOutputStream.getBytesSize(mediaEncryptedSha2560);
}
}
var interactiveAnnotationsRepeatedField = object.interactiveAnnotations();
if (interactiveAnnotationsRepeatedField != null) {
for (var interactiveAnnotationsEntry : interactiveAnnotationsRepeatedField) {
if (interactiveAnnotationsEntry != null) {
protoSize += ProtobufOutputStream.getFieldSize(10, 2);
var interactiveAnnotationsEntrySerializedSize = it.auties.whatsapp.model.button.interactive.InteractiveLocationAnnotationSpec.sizeOf(interactiveAnnotationsEntry);
protoSize += ProtobufOutputStream.getVarIntSize(interactiveAnnotationsEntrySerializedSize);
protoSize += interactiveAnnotationsEntrySerializedSize;
}
}
}
var mediaDirectPath = object.mediaDirectPath();
if (mediaDirectPath != null) {
var mediaDirectPath0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(mediaDirectPath);
if (mediaDirectPath0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(11, 2);
protoSize += ProtobufOutputStream.getStringSize(mediaDirectPath0);
}
}
var mediaKeyTimestampSeconds = object.mediaKeyTimestampSeconds();
if (mediaKeyTimestampSeconds != null) {
var mediaKeyTimestampSeconds0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableLong(mediaKeyTimestampSeconds);
if (mediaKeyTimestampSeconds0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(12, 0);
protoSize += ProtobufOutputStream.getVarIntSize(mediaKeyTimestampSeconds0);
}
}
var thumbnail = object.thumbnail();
if (thumbnail != null) {
var thumbnail0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnail);
if (thumbnail0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(16, 2);
protoSize += ProtobufOutputStream.getBytesSize(thumbnail0);
}
}
var contextInfo = object.contextInfo();
if (contextInfo != null) {
var contextInfo0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(contextInfo);
if (contextInfo0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(17, 2);
var contextInfo0SerializedSize = it.auties.whatsapp.model.info.ContextInfoSpec.sizeOf(contextInfo0);
protoSize += ProtobufOutputStream.getVarIntSize(contextInfo0SerializedSize);
protoSize += contextInfo0SerializedSize;
}
}
var firstScanSidecar = object.firstScanSidecar();
if (firstScanSidecar != null) {
var firstScanSidecar0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(firstScanSidecar);
if (firstScanSidecar0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(18, 2);
protoSize += ProtobufOutputStream.getBytesSize(firstScanSidecar0);
}
}
var firstScanLength = object.firstScanLength();
if (firstScanLength != null) {
var firstScanLength0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(firstScanLength);
if (firstScanLength0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(19, 0);
protoSize += ProtobufOutputStream.getVarIntSize(firstScanLength0);
}
}
var experimentGroupId = object.experimentGroupId();
if (experimentGroupId != null) {
var experimentGroupId0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableInt(experimentGroupId);
if (experimentGroupId0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(20, 0);
protoSize += ProtobufOutputStream.getVarIntSize(experimentGroupId0);
}
}
var scansSidecar = object.scansSidecar();
if (scansSidecar != null) {
var scansSidecar0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(scansSidecar);
if (scansSidecar0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(21, 2);
protoSize += ProtobufOutputStream.getBytesSize(scansSidecar0);
}
}
var scanLengthsRepeatedField = object.scanLengths();
if (scanLengthsRepeatedField != null) {
for (var scanLengthsEntry : scanLengthsRepeatedField) {
if (scanLengthsEntry != null) {
protoSize += ProtobufOutputStream.getFieldSize(22, 0);
protoSize += ProtobufOutputStream.getVarIntSize(scanLengthsEntry);
}
}
}
var midQualityFileSha256 = object.midQualityFileSha256();
if (midQualityFileSha256 != null) {
var midQualityFileSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(midQualityFileSha256);
if (midQualityFileSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(23, 2);
protoSize += ProtobufOutputStream.getBytesSize(midQualityFileSha2560);
}
}
var midQualityFileEncSha256 = object.midQualityFileEncSha256();
if (midQualityFileEncSha256 != null) {
var midQualityFileEncSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(midQualityFileEncSha256);
if (midQualityFileEncSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(24, 2);
protoSize += ProtobufOutputStream.getBytesSize(midQualityFileEncSha2560);
}
}
var viewOnce = object.viewOnce();
protoSize += ProtobufOutputStream.getFieldSize(25, 0);
protoSize += 1;
var thumbnailDirectPath = object.thumbnailDirectPath();
if (thumbnailDirectPath != null) {
var thumbnailDirectPath0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailDirectPath);
if (thumbnailDirectPath0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(26, 2);
protoSize += ProtobufOutputStream.getStringSize(thumbnailDirectPath0);
}
}
var thumbnailSha256 = object.thumbnailSha256();
if (thumbnailSha256 != null) {
var thumbnailSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailSha256);
if (thumbnailSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(27, 2);
protoSize += ProtobufOutputStream.getBytesSize(thumbnailSha2560);
}
}
var thumbnailEncSha256 = object.thumbnailEncSha256();
if (thumbnailEncSha256 != null) {
var thumbnailEncSha2560 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(thumbnailEncSha256);
if (thumbnailEncSha2560 != null) {
protoSize += ProtobufOutputStream.getFieldSize(28, 2);
protoSize += ProtobufOutputStream.getBytesSize(thumbnailEncSha2560);
}
}
var staticUrl = object.staticUrl();
if (staticUrl != null) {
var staticUrl0 = it.auties.protobuf.builtin.ProtobufOptionalMixin.toNullableValue(staticUrl);
if (staticUrl0 != null) {
protoSize += ProtobufOutputStream.getFieldSize(29, 2);
protoSize += ProtobufOutputStream.getStringSize(staticUrl0);
}
}
return protoSize;
}
}