package com.google.protobuf.nano;

import java.io.IOException;
import java.util.Objects;

/* compiled from: TbsSdkJava */
public final class Any extends MessageNano {
    private static volatile Any[] _emptyArray;
    private int bitField0_;
    private String typeUrl_;
    private byte[] value_;

    public Any() {
        clear();
    }

    public static Any[] emptyArray() {
        if (_emptyArray == null) {
            synchronized (InternalNano.LAZY_INIT_LOCK) {
                if (_emptyArray == null) {
                    _emptyArray = new Any[0];
                }
            }
        }
        return _emptyArray;
    }

    public static Any parseFrom(byte[] bArr) throws InvalidProtocolBufferNanoException {
        return (Any) MessageNano.mergeFrom(new Any(), bArr);
    }

    public Any clear() {
        this.bitField0_ = 0;
        this.typeUrl_ = "";
        this.value_ = WireFormatNano.EMPTY_BYTES;
        this.cachedSize = -1;
        return this;
    }

    public Any clearTypeUrl() {
        this.typeUrl_ = "";
        this.bitField0_ &= -2;
        return this;
    }

    public Any clearValue() {
        this.value_ = WireFormatNano.EMPTY_BYTES;
        this.bitField0_ &= -3;
        return this;
    }

    /* access modifiers changed from: protected */
    public int computeSerializedSize() {
        int computeSerializedSize = super.computeSerializedSize();
        if ((this.bitField0_ & 1) != 0) {
            computeSerializedSize += CodedOutputByteBufferNano.computeStringSize(1, this.typeUrl_);
        }
        return (this.bitField0_ & 2) != 0
                ? computeSerializedSize + CodedOutputByteBufferNano.computeBytesSize(2, this.value_)
                : computeSerializedSize;
    }

    public String getTypeUrl() {
        return this.typeUrl_;
    }

    public byte[] getValue() {
        return this.value_;
    }

    public boolean hasTypeUrl() {
        return (this.bitField0_ & 1) != 0;
    }

    public boolean hasValue() {
        return (this.bitField0_ & 2) != 0;
    }

    public Any setTypeUrl(String str) {
        Objects.requireNonNull(str);
        this.typeUrl_ = str;
        this.bitField0_ |= 1;
        return this;
    }

    public Any setValue(byte[] bArr) {
        Objects.requireNonNull(bArr);
        this.value_ = bArr;
        this.bitField0_ |= 2;
        return this;
    }

    public void writeTo(CodedOutputByteBufferNano codedOutputByteBufferNano) throws IOException {
        if ((this.bitField0_ & 1) != 0) {
            codedOutputByteBufferNano.writeString(1, this.typeUrl_);
        }
        if ((this.bitField0_ & 2) != 0) {
            codedOutputByteBufferNano.writeBytes(2, this.value_);
        }
        super.writeTo(codedOutputByteBufferNano);
    }

    public static Any parseFrom(CodedInputByteBufferNano codedInputByteBufferNano) throws IOException {
        return new Any().mergeFrom(codedInputByteBufferNano);
    }

    public Any mergeFrom(CodedInputByteBufferNano codedInputByteBufferNano) throws IOException {
        while (true) {
            int readTag = codedInputByteBufferNano.readTag();
            if (readTag == 0) {
                return this;
            }
            if (readTag == 10) {
                this.typeUrl_ = codedInputByteBufferNano.readString();
                this.bitField0_ |= 1;
            } else if (readTag == 18) {
                this.value_ = codedInputByteBufferNano.readBytes();
                this.bitField0_ |= 2;
            } else if (!WireFormatNano.parseUnknownField(codedInputByteBufferNano, readTag)) {
                return this;
            }
        }
    }
}
