private void writeThrows(int[] exceptions) { if (throwsIndex == 0) throwsIndex = constPool.addUtf8Info(ExceptionsAttribute.tag); output.writeShort(throwsIndex); output.writeInt(exceptions.length * 2 + 2); output.writeShort(exceptions.length); for (int i = 0; i < exceptions.length; i++) output.writeShort(exceptions[i]); }
/** * Adds a new <code>CONSTANT_NameAndType_info</code> structure. * * @param name <code>name_index</code> * @param type <code>descriptor_index</code> * @return the index of the added entry. */ public int addNameAndTypeInfo(String name, String type) { return addNameAndTypeInfo(addUtf8Info(name), addUtf8Info(type)); }
/** * Adds a new <code>CONSTANT_NameAndType_info</code> structure. * * @param name <code>name_index</code> * @param type <code>descriptor_index</code> * @return the index of the added entry. */ public int addNameAndTypeInfo(String name, String type) { return addNameAndTypeInfo(addUtf8Info(name), addUtf8Info(type)); }
private void writeThrows(int[] exceptions) { if (throwsIndex == 0) throwsIndex = constPool.addUtf8Info(ExceptionsAttribute.tag); output.writeShort(throwsIndex); output.writeInt(exceptions.length * 2 + 2); output.writeShort(exceptions.length); for (int i = 0; i < exceptions.length; i++) output.writeShort(exceptions[i]); }
codeIndex = constPool.addUtf8Info(CodeAttribute.tag);
/** * Ends adding a new method. The <code>add</code> method must be * called before the <code>end</code> method is called. * * @param smap a stack map table. may be null. * @param aw attributes to the <code>Code_attribute</code>. * may be null. */ public void end(StackMapTable.Writer smap, AttributeWriter aw) { if (isAbstract) return; // exception_table_length output.writeShort(catchPos, catchCount); int attrCount = smap == null ? 0 : 1; writeAttribute(output, aw, attrCount); if (smap != null) { if (stackIndex == 0) stackIndex = constPool.addUtf8Info(StackMapTable.tag); output.writeShort(stackIndex); byte[] data = smap.toByteArray(); output.writeInt(data.length); output.write(data); } // Code attribute_length output.writeInt(startPos + 2, output.getPos() - startPos - 6); }
/** * Starts Adding a new method. * * @param accessFlags access flags. * @param name the method name. * @param descriptor the method signature. * @param exceptions throws clause. It may be null. * The class names must be the JVM-internal * representations like <code>java/lang/Exception</code>. * @param aw attributes to the <code>Method_info</code>. */ public void begin(int accessFlags, String name, String descriptor, String[] exceptions, AttributeWriter aw) { int nameIndex = constPool.addUtf8Info(name); int descIndex = constPool.addUtf8Info(descriptor); int[] intfs; if (exceptions == null) intfs = null; else intfs = constPool.addClassInfo(exceptions); begin(accessFlags, nameIndex, descIndex, intfs, aw); }
/** * Adds a new <code>CONSTANT_Class_info</code> structure. * * <p>This also adds a <code>CONSTANT_Utf8_info</code> structure * for storing the class name. * * @param jvmname the JVM-internal representation of a class name. * e.g. <code>java/lang/Object</code>. * @return the index of the added entry. */ public int addClassInfo(String jvmname) { int utf8 = addUtf8Info(jvmname); output.write(ClassInfo.tag); output.writeShort(utf8); return num++; }
/** * Adds a new <code>CONSTANT_String_info</code> * structure. * * <p>This also adds a new <code>CONSTANT_Utf8_info</code> * structure. * * @return the index of the added entry. */ public int addStringInfo(String str) { int utf8 = addUtf8Info(str); output.write(StringInfo.tag); output.writeShort(utf8); return num++; }
codeIndex = constPool.addUtf8Info(CodeAttribute.tag);
/** * Adds a new field. * * @param accessFlags access flags. * @param name the field name. * @param descriptor the field type. * @param aw the attributes of the field. may be null. * @see AccessFlag */ public void add(int accessFlags, String name, String descriptor, AttributeWriter aw) { int nameIndex = constPool.addUtf8Info(name); int descIndex = constPool.addUtf8Info(descriptor); add(accessFlags, nameIndex, descIndex, aw); }
/** * Ends adding a new method. The <code>add</code> method must be * called before the <code>end</code> method is called. * * @param smap a stack map table. may be null. * @param aw attributes to the <code>Code_attribute</code>. * may be null. */ public void end(StackMapTable.Writer smap, AttributeWriter aw) { if (isAbstract) return; // exception_table_length output.writeShort(catchPos, catchCount); int attrCount = smap == null ? 0 : 1; writeAttribute(output, aw, attrCount); if (smap != null) { if (stackIndex == 0) stackIndex = constPool.addUtf8Info(StackMapTable.tag); output.writeShort(stackIndex); byte[] data = smap.toByteArray(); output.writeInt(data.length); output.write(data); } // Code attribute_length output.writeInt(startPos + 2, output.getPos() - startPos - 6); }
private void writeThrows(int[] exceptions) { if (throwsIndex == 0) throwsIndex = constPool.addUtf8Info(ExceptionsAttribute.tag); output.writeShort(throwsIndex); output.writeInt(exceptions.length * 2 + 2); output.writeShort(exceptions.length); for (int i = 0; i < exceptions.length; i++) output.writeShort(exceptions[i]); }
/** * Starts Adding a new method. * * @param accessFlags access flags. * @param name the method name. * @param descriptor the method signature. * @param exceptions throws clause. It may be null. * The class names must be the JVM-internal * representations like <code>java/lang/Exception</code>. * @param aw attributes to the <code>Method_info</code>. */ public void begin(int accessFlags, String name, String descriptor, String[] exceptions, AttributeWriter aw) { int nameIndex = constPool.addUtf8Info(name); int descIndex = constPool.addUtf8Info(descriptor); int[] intfs; if (exceptions == null) intfs = null; else intfs = constPool.addClassInfo(exceptions); begin(accessFlags, nameIndex, descIndex, intfs, aw); }
/** * Adds a new <code>CONSTANT_NameAndType_info</code> structure. * * @param name <code>name_index</code> * @param type <code>descriptor_index</code> * @return the index of the added entry. */ public int addNameAndTypeInfo(String name, String type) { return addNameAndTypeInfo(addUtf8Info(name), addUtf8Info(type)); }
/** * Adds a new <code>CONSTANT_Class_info</code> structure. * * <p>This also adds a <code>CONSTANT_Utf8_info</code> structure * for storing the class name. * * @param jvmname the JVM-internal representation of a class name. * e.g. <code>java/lang/Object</code>. * @return the index of the added entry. */ public int addClassInfo(String jvmname) { int utf8 = addUtf8Info(jvmname); output.write(ClassInfo.tag); output.writeShort(utf8); return num++; }
/** * Adds a new field. * * @param accessFlags access flags. * @param name the field name. * @param descriptor the field type. * @param aw the attributes of the field. may be null. * @see AccessFlag */ public void add(int accessFlags, String name, String descriptor, AttributeWriter aw) { int nameIndex = constPool.addUtf8Info(name); int descIndex = constPool.addUtf8Info(descriptor); add(accessFlags, nameIndex, descIndex, aw); }
/** * Adds a new <code>CONSTANT_String_info</code> * structure. * * <p>This also adds a new <code>CONSTANT_Utf8_info</code> * structure. * * @return the index of the added entry. */ public int addStringInfo(String str) { int utf8 = addUtf8Info(str); output.write(StringInfo.tag); output.writeShort(utf8); return num++; }
private void writeThrows(int[] exceptions) { if (throwsIndex == 0) throwsIndex = constPool.addUtf8Info(ExceptionsAttribute.tag); output.writeShort(throwsIndex); output.writeInt(exceptions.length * 2 + 2); output.writeShort(exceptions.length); for (int i = 0; i < exceptions.length; i++) output.writeShort(exceptions[i]); }
/** * Adds a new <code>CONSTANT_NameAndType_info</code> structure. * * @param name <code>name_index</code> * @param type <code>descriptor_index</code> * @return the index of the added entry. */ public int addNameAndTypeInfo(String name, String type) { return addNameAndTypeInfo(addUtf8Info(name), addUtf8Info(type)); }