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

org.raystack.depot.message.proto.UnknownProtoFields Maven / Gradle / Ivy

The newest version!
package org.raystack.depot.message.proto;

import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.UnknownFieldSet;
import lombok.extern.slf4j.Slf4j;

/**
 * Try to convert raw proto bytes to some meaningful representation that is good
 * enough for debug.
 */
@Slf4j
public class UnknownProtoFields {
    public static String toString(byte[] message) {
        String convertedFields = "";
        try {
            convertedFields = UnknownFieldSet.parseFrom(message).toString();
        } catch (InvalidProtocolBufferException e) {
            log.warn("invalid byte representation of a protobuf message: {}", new String(message));
        }
        return convertedFields;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy