public KotlinClass AsClassMetadata() { if (Kind != KotlinMetadataKind.Class) { return(null); } var md = KotlinBitEncoding.DecodeBytes(Data1); using (var ms = ToMemoryStream(md)) { // The first element is the length of the string table var first = ms.ReadByte(); if (first == -1) { return(null); } ms.Position = 0; var size = KotlinBitEncoding.ReadRawVarint32(ms); using (var partial = new PartialStream(ms, ms.Position, size)) { // Read the string table from the stream var string_table = Serializer.Deserialize <org.jetbrains.kotlin.metadata.jvm.StringTableTypes> (partial); var resolver = new JvmNameResolver(string_table, Data2.ToList()); partial.MoveNext(); // Read the metadata structure from the stream var metadata = Serializer.Deserialize <org.jetbrains.kotlin.metadata.jvm.Class> (partial); return(KotlinClass.FromProtobuf(metadata, resolver)); } } }
public KotlinClass AsClassMetadata() { if (Kind != KotlinMetadataKind.Class) { return(null); } var data = ParseStream <org.jetbrains.kotlin.metadata.jvm.Class> (); return(KotlinClass.FromProtobuf(data.Item1, data.Item2)); }