private static OutputPrefixType toProtoOutputPrefixType(AesGcmSivParameters.Variant variant)
      throws GeneralSecurityException {
    if (AesGcmSivParameters.Variant.TINK.equals(variant)) {
      return OutputPrefixType.TINK;
    }
    if (AesGcmSivParameters.Variant.CRUNCHY.equals(variant)) {
      return OutputPrefixType.CRUNCHY;
    }
    if (AesGcmSivParameters.Variant.NO_PREFIX.equals(variant)) {
      return OutputPrefixType.RAW;
    }
    throw new GeneralSecurityException("Unable to serialize variant: " + variant);
  }
Methods to serialize and parse {@link AesGcmSivKey} objects and {@link AesGcmSivParameters}
objects
java_src/src/main/java/com/google/crypto/tink/aead/internal/AesGcmSivProtoSerialization.java