private static AttributeCode ReadAttributeCode(BytecodeReader reader, ConstantPool cp) { ushort attributeNameIndex = reader.ReadUShort(); uint attributesLength = reader.ReadUInt(); ushort maxStack = reader.ReadUShort(); ushort maxLocals = reader.ReadUShort(); uint codeLength = reader.ReadUInt(); // typecasting could be bad byte[] bytecode = reader.ReadArray((int)codeLength); ushort exceptionTableLength = reader.ReadUShort(); byte[] exceptionTable = reader.ReadArray(exceptionTableLength * 8); ushort attributesCount = reader.ReadUShort(); Attributes attributes = ReadAttributes(reader, attributesCount, cp); return(new AttributeCode(attributeNameIndex, attributesLength, maxStack, maxLocals, codeLength, bytecode, exceptionTableLength, exceptionTable, attributesCount, attributes)); }
private static AttributeLineNumberTable ReadAttributeLineNumberTable(BytecodeReader reader) { ushort attributeNameIndex = reader.ReadUShort(); uint attributeLength = reader.ReadUInt(); ushort lineNumberTableLength = reader.ReadUShort(); List <byte[]> startPC = new List <byte[]>(); List <byte[]> lineNumber = new List <byte[]>(); for (int i = 0; i < lineNumberTableLength; i++) { startPC.Add(reader.ReadArray(2)); lineNumber.Add(reader.ReadArray(2)); } return(new AttributeLineNumberTable(attributeNameIndex, attributeLength, lineNumberTableLength, startPC, lineNumber)); }