/// <exception cref="System.IO.IOException"/> protected internal virtual StructGeneralAttribute ReadAttribute(DataInputFullStream @in, ConstantPool pool, string name) { StructGeneralAttribute attribute = StructGeneralAttribute.CreateAttribute(name); int length = @in.ReadInt(); if (attribute == null) { @in.Discard(length); } else { attribute.InitContent(@in, pool); } return(attribute); }
/// <exception cref="System.IO.IOException"/> protected internal virtual Dictionary <string, StructGeneralAttribute> ReadAttributes (DataInputFullStream @in, ConstantPool pool) { int length = @in.ReadUnsignedShort(); Dictionary <string, StructGeneralAttribute> attributes = new Dictionary <string, StructGeneralAttribute >(length); for (int i = 0; i < length; i++) { int nameIndex = @in.ReadUnsignedShort(); string name = pool.GetPrimitiveConstant(nameIndex).GetString(); StructGeneralAttribute attribute = ReadAttribute(@in, pool, name); if (attribute != null) { if (StructGeneralAttribute.Attribute_Local_Variable_Table.GetName().Equals(name) && attributes.ContainsKey(name)) { // merge all variable tables StructLocalVariableTableAttribute table = (StructLocalVariableTableAttribute)attributes .GetOrNull(name); table.Add((StructLocalVariableTableAttribute)attribute); } else if (StructGeneralAttribute.Attribute_Local_Variable_Type_Table.GetName().Equals (name) && attributes.ContainsKey(name)) { // merge all variable tables StructLocalVariableTypeTableAttribute table = (StructLocalVariableTypeTableAttribute )attributes.GetOrNull(name); table.Add((StructLocalVariableTypeTableAttribute)attribute); } else { Sharpen.Collections.Put(attributes, attribute.GetName(), attribute); } } } return(attributes); }