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

it.auties.protobuf.ProtobufMessageSpec Maven / Gradle / Ivy

The newest version!
package it.auties.protobuf;

import it.auties.protobuf.stream.ProtobufInputStream;

import java.util.HashMap;
import java.util.Map;

public class ProtobufMessageSpec {
    public static Map decode(byte[] bytes) {
        return decode(ProtobufInputStream.fromBytes(bytes, 0, bytes.length));
    }

    public static Map decode(ProtobufInputStream protoInputStream) {
        var result = new HashMap();
        while (protoInputStream.readTag()) {
            var key = protoInputStream.index();
            var value = protoInputStream.readUnknown(true);
            result.put(key, value);
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy