No public description

PiperOrigin-RevId: 583417701
This commit is contained in:
Sebastian Schmidt 2023-11-17 09:57:05 -08:00 committed by Copybara-Service
parent e7c7638833
commit 9456c64830

View File

@ -128,6 +128,16 @@ public final class PacketGetter {
return ProtoUtil.unpack(result, defaultInstance);
}
public static <T extends MessageLite> T getProto(final Packet packet, Parser<T> messageParser) {
SerializedMessage result = new SerializedMessage();
nativeGetProto(packet.getNativeHandle(), result);
try {
return messageParser.parseFrom(result.value);
} catch (InvalidProtocolBufferException e) {
throw new IllegalArgumentException(e);
}
}
/**
* @deprecated {@link #getProto(Packet, MessageLite)} is safer to use in obfuscated builds.
*/