/** * Creates a new ProgramClassReader for reading from the given DataInput. */ public LibraryClassReader(DataInput dataInput, boolean skipNonPublicClasses, boolean skipNonPublicClassMembers) { this.dataInput = new RuntimeDataInput(dataInput); this.skipNonPublicClasses = skipNonPublicClasses; this.skipNonPublicClassMembers = skipNonPublicClassMembers; }
public void visitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant) { doubleConstant.f8value = dataInput.readDouble(); }
public void visitFloatConstant(Clazz clazz, FloatConstant floatConstant) { floatConstant.f4value = dataInput.readFloat(); }
public void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant) { methodHandleConstant.u1referenceKind = dataInput.readUnsignedByte(); methodHandleConstant.u2referenceIndex = dataInput.readUnsignedShort(); }
public void visitPrimitiveArrayConstant(Clazz clazz, PrimitiveArrayConstant primitiveArrayConstant) char u2primitiveType = dataInput.readChar(); int u4length = dataInput.readInt(); values[index] = dataInput.readBoolean(); dataInput.readFully(values); values[index] = dataInput.readChar(); values[index] = dataInput.readShort(); values[index] = dataInput.readInt(); values[index] = dataInput.readFloat(); values[index] = dataInput.readLong(); values[index] = dataInput.readDouble();
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute) { // Read the stack size and local variable frame size. codeAttribute.u2maxStack = dataInput.readUnsignedShort(); codeAttribute.u2maxLocals = dataInput.readUnsignedShort(); // Read the byte code. codeAttribute.u4codeLength = dataInput.readInt(); byte[] code = new byte[codeAttribute.u4codeLength]; dataInput.readFully(code); codeAttribute.code = code; // Read the exceptions. codeAttribute.u2exceptionTableLength = dataInput.readUnsignedShort(); codeAttribute.exceptionTable = new ExceptionInfo[codeAttribute.u2exceptionTableLength]; for (int index = 0; index < codeAttribute.u2exceptionTableLength; index++) { ExceptionInfo exceptionInfo = new ExceptionInfo(); visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo); codeAttribute.exceptionTable[index] = exceptionInfo; } // Read the code attributes. codeAttribute.u2attributesCount = dataInput.readUnsignedShort(); codeAttribute.attributes = new Attribute[codeAttribute.u2attributesCount]; for (int index = 0; index < codeAttribute.u2attributesCount; index++) { Attribute attribute = createAttribute(clazz); attribute.accept(clazz, method, codeAttribute, this); codeAttribute.attributes[index] = attribute; } }
public void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant) { int u2length = dataInput.readUnsignedShort(); // Read the UTF-8 bytes. byte[] bytes = new byte[u2length]; dataInput.readFully(bytes); utf8Constant.setBytes(bytes); }
public void visitProgramClass(ProgramClass programClass) programClass.u4magic = dataInput.readInt(); int u2minorVersion = dataInput.readUnsignedShort(); int u2majorVersion = dataInput.readUnsignedShort(); programClass.u2constantPoolCount = dataInput.readUnsignedShort(); programClass.u2accessFlags = dataInput.readUnsignedShort(); programClass.u2thisClass = dataInput.readUnsignedShort(); programClass.u2superClass = dataInput.readUnsignedShort(); programClass.u2interfacesCount = dataInput.readUnsignedShort(); programClass.u2interfaces[index] = dataInput.readUnsignedShort(); programClass.u2fieldsCount = dataInput.readUnsignedShort(); programClass.u2methodsCount = dataInput.readUnsignedShort(); programClass.u2attributesCount = dataInput.readUnsignedShort();
public void visitTypeParameterBoundTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TypeParameterBoundTargetInfo typeParameterBoundTargetInfo) { typeParameterBoundTargetInfo.u1typeParameterIndex = dataInput.readUnsignedByte(); typeParameterBoundTargetInfo.u1boundIndex = dataInput.readUnsignedByte(); }
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo) { localVariableTypeInfo.u2startPC = dataInput.readUnsignedShort(); localVariableTypeInfo.u2length = dataInput.readUnsignedShort(); localVariableTypeInfo.u2nameIndex = dataInput.readUnsignedShort(); localVariableTypeInfo.u2signatureIndex = dataInput.readUnsignedShort(); localVariableTypeInfo.u2index = dataInput.readUnsignedShort(); }
public void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant) { dataInput.skipBytes(4); }
public void visitUnknownAttribute(Clazz clazz, UnknownAttribute unknownAttribute) { // Read the unknown information. byte[] info = new byte[unknownAttribute.u4attributeLength]; dataInput.readFully(info); unknownAttribute.info = info; }
public void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant) { integerConstant.u4value = dataInput.readInt(); }
public void visitLongConstant(Clazz clazz, LongConstant longConstant) { longConstant.u8value = dataInput.readLong(); }
public void visitPrimitiveArrayConstant(Clazz clazz, PrimitiveArrayConstant primitiveArrayConstant) char u2primitiveType = dataInput.readChar(); int u4length = dataInput.readInt(); values[index] = dataInput.readBoolean(); dataInput.readFully(values); values[index] = dataInput.readChar(); values[index] = dataInput.readShort(); values[index] = dataInput.readInt(); values[index] = dataInput.readFloat(); values[index] = dataInput.readLong(); values[index] = dataInput.readDouble();
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute) { // Read the stack size and local variable frame size. codeAttribute.u2maxStack = dataInput.readUnsignedShort(); codeAttribute.u2maxLocals = dataInput.readUnsignedShort(); // Read the byte code. codeAttribute.u4codeLength = dataInput.readInt(); byte[] code = new byte[codeAttribute.u4codeLength]; dataInput.readFully(code); codeAttribute.code = code; // Read the exceptions. codeAttribute.u2exceptionTableLength = dataInput.readUnsignedShort(); codeAttribute.exceptionTable = new ExceptionInfo[codeAttribute.u2exceptionTableLength]; for (int index = 0; index < codeAttribute.u2exceptionTableLength; index++) { ExceptionInfo exceptionInfo = new ExceptionInfo(); visitExceptionInfo(clazz, method, codeAttribute, exceptionInfo); codeAttribute.exceptionTable[index] = exceptionInfo; } // Read the code attributes. codeAttribute.u2attributesCount = dataInput.readUnsignedShort(); codeAttribute.attributes = new Attribute[codeAttribute.u2attributesCount]; for (int index = 0; index < codeAttribute.u2attributesCount; index++) { Attribute attribute = createAttribute(clazz); attribute.accept(clazz, method, codeAttribute, this); codeAttribute.attributes[index] = attribute; } }
public void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant) { int u2length = dataInput.readUnsignedShort(); // Read the UTF-8 bytes. byte[] bytes = new byte[u2length]; dataInput.readFully(bytes); utf8Constant.setBytes(bytes); }
public void visitTypeArgumentTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, TypeArgumentTargetInfo typeArgumentTargetInfo) { typeArgumentTargetInfo.u2offset = dataInput.readUnsignedShort(); typeArgumentTargetInfo.u1typeArgumentIndex = dataInput.readUnsignedByte(); }