org.raystack.depot.message.proto.UnknownProtoFields Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of depot Show documentation
Show all versions of depot Show documentation
A sink connector library containing multiple sink implementations
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;
}
}