导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - ProtoLiteUtils.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 ProtoLiteUtils.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.grpc.protobuf.lite;

import com.google.common.base.Preconditions;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.MessageLite;
import com.google.protobuf.Parser;
import defpackage.q34;
import io.grpc.ExperimentalApi;
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.Reference;

@ExperimentalApi("Experimental until Lite is stable in protobuf")
public final class ProtoLiteUtils {
    public static volatile ExtensionRegistryLite a = ExtensionRegistryLite.getEmptyRegistry();

    public static final class a<T extends MessageLite> implements MethodDescriptor.PrototypeMarshaller<T> {
        public static final ThreadLocal<Reference<byte[]>> c = new ThreadLocal<>();
        public final Parser<T> a;
        public final T b;

        public a(T t) {
            this.b = t;
            this.a = t.getParserForType();
        }

        public T getMessagePrototype() {
            return this.b;
        }

        public T parse(java.io.InputStream r6) {
            throw new UnsupportedOperationException("Method not decompiled: io.grpc.protobuf.lite.ProtoLiteUtils.a.parse(java.io.InputStream):com.google.protobuf.MessageLite");
        }

        public final T c(CodedInputStream codedInputStream) throws InvalidProtocolBufferException {
            T t = (T) this.a.parseFrom(codedInputStream, ProtoLiteUtils.a);
            try {
                codedInputStream.checkLastTagWas(0);
                return t;
            } catch (InvalidProtocolBufferException e) {
                e.setUnfinishedMessage(t);
                throw e;
            }
        }

        public InputStream stream(T t) {
            return new q34(t, this.a);
        }

        public Class<T> getMessageClass() {
            return (Class<T>) this.b.getClass();
        }
    }

    public static final class b<T extends MessageLite> implements Metadata.BinaryMarshaller<T> {
        public final T a;

        public b(T t) {
            this.a = t;
        }

        public T parseBytes(byte[] bArr) {
            try {
                return (T) this.a.getParserForType().parseFrom(bArr, ProtoLiteUtils.a);
            } catch (InvalidProtocolBufferException e) {
                throw new IllegalArgumentException((Throwable) e);
            }
        }

        public byte[] toBytes(T t) {
            return t.toByteArray();
        }
    }

    public static long a(InputStream inputStream, OutputStream outputStream) throws IOException {
        Preconditions.checkNotNull(inputStream, "inputStream cannot be null!");
        Preconditions.checkNotNull(outputStream, "outputStream cannot be null!");
        byte[] bArr = new byte[8192];
        long j = 0;
        while (true) {
            int read = inputStream.read(bArr);
            if (read == -1) {
                return j;
            }
            outputStream.write(bArr, 0, read);
            j += read;
        }
    }

    public static <T extends MessageLite> MethodDescriptor.Marshaller<T> marshaller(T t) {
        return new a(t);
    }

    public static <T extends MessageLite> Metadata.BinaryMarshaller<T> metadataMarshaller(T t) {
        return new b(t);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1787")
    public static void setExtensionRegistry(ExtensionRegistryLite extensionRegistryLite) {
        a = (ExtensionRegistryLite) Preconditions.checkNotNull(extensionRegistryLite, "newRegistry");
    }
}