/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { return new SourceFileAttribute(newCp, getFileName()); } }
/** * Returns the file name indicated by <code>sourcefile_index</code>. */ public String getFileName() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
/** * Constructs a SourceFile attribute. * * @param cp a constant pool table. * @param filename the name of the source file. */ public SourceFileAttribute(ConstPool cp, String filename) { super(cp, tag); int index = cp.addUtf8Info(filename); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
/** * Constructs a class file including no members. * * @param isInterface * true if this is an interface. false if this is a class. * @param classname * a fully-qualified class name * @param superclass * a fully-qualified super class name or null. */ public ClassFile(boolean isInterface, String classname, String superclass) { major = MAJOR_VERSION; minor = 0; // JDK 1.3 or later constPool = new ConstPool(classname); thisClass = constPool.getThisClassInfo(); if (isInterface) accessFlags = AccessFlag.INTERFACE | AccessFlag.ABSTRACT; else accessFlags = AccessFlag.SUPER; initSuperclass(superclass); interfaces = null; fields = new ArrayList(); methods = new ArrayList(); thisclassname = classname; attributes = new ArrayList(); attributes.add(new SourceFileAttribute(constPool, getSourcefileName(thisclassname))); }
/** * Returns the source file containing this class. * * @return null if this information is not available. */ public String getSourceFile() { SourceFileAttribute sf = (SourceFileAttribute)getAttribute(SourceFileAttribute.tag); if (sf == null) return null; else return sf.getFileName(); }
/** * Constructs a class file including no members. * * @param isInterface * true if this is an interface. false if this is a class. * @param classname * a fully-qualified class name * @param superclass * a fully-qualified super class name or null. */ public ClassFile(boolean isInterface, String classname, String superclass) { major = MAJOR_VERSION; minor = 0; // JDK 1.3 or later constPool = new ConstPool(classname); thisClass = constPool.getThisClassInfo(); if (isInterface) accessFlags = AccessFlag.INTERFACE | AccessFlag.ABSTRACT; else accessFlags = AccessFlag.SUPER; initSuperclass(superclass); interfaces = null; fields = new ArrayList<FieldInfo>(); methods = new ArrayList<MethodInfo>(); thisclassname = classname; attributes = new ArrayList<AttributeInfo>(); attributes.add(new SourceFileAttribute(constPool, getSourcefileName(thisclassname))); }
/** * Returns the source file containing this class. * * @return null if this information is not available. */ public String getSourceFile() { SourceFileAttribute sf = (SourceFileAttribute)getAttribute(SourceFileAttribute.tag); if (sf == null) return null; return sf.getFileName(); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ @Override public AttributeInfo copy(ConstPool newCp, Map<String,String> classnames) { return new SourceFileAttribute(newCp, getFileName()); } }
/** * Returns the file name indicated by <code>sourcefile_index</code>. */ public String getFileName() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
return new SignatureAttribute(cp, name, in); else if (nameStr.equals(SourceFileAttribute.tag)) return new SourceFileAttribute(cp, name, in); else if (nameStr.equals(SyntheticAttribute.tag)) return new SyntheticAttribute(cp, name, in);
/** * Returns the source file containing this class. * * @return null if this information is not available. */ public String getSourceFile() { SourceFileAttribute sf = (SourceFileAttribute)getAttribute(SourceFileAttribute.tag); if (sf == null) return null; else return sf.getFileName(); }
/** * Constructs a SourceFile attribute. * * @param cp a constant pool table. * @param filename the name of the source file. */ public SourceFileAttribute(ConstPool cp, String filename) { super(cp, tag); int index = cp.addUtf8Info(filename); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { return new SourceFileAttribute(newCp, getFileName()); } }
/** * Returns the file name indicated by <code>sourcefile_index</code>. */ public String getFileName() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
return new SignatureAttribute(cp, name, in); else if (nameStr.equals(SourceFileAttribute.tag)) return new SourceFileAttribute(cp, name, in); else if (nameStr.equals(SyntheticAttribute.tag)) return new SyntheticAttribute(cp, name, in);
/** * Returns the source file containing this class. * * @return null if this information is not available. */ public String getSourceFile() { SourceFileAttribute sf = (SourceFileAttribute)getAttribute(SourceFileAttribute.tag); if (sf == null) return null; else return sf.getFileName(); }
/** * Constructs a SourceFile attribute. * * @param cp a constant pool table. * @param filename the name of the source file. */ public SourceFileAttribute(ConstPool cp, String filename) { super(cp, tag); int index = cp.addUtf8Info(filename); byte[] bvalue = new byte[2]; bvalue[0] = (byte)(index >>> 8); bvalue[1] = (byte)index; set(bvalue); }
/** * Makes a copy. Class names are replaced according to the * given <code>Map</code> object. * * @param newCp the constant pool table used by the new copy. * @param classnames pairs of replaced and substituted * class names. */ public AttributeInfo copy(ConstPool newCp, Map classnames) { return new SourceFileAttribute(newCp, getFileName()); } }
/** * Returns the file name indicated by <code>sourcefile_index</code>. */ public String getFileName() { return getConstPool().getUtf8Info(ByteArray.readU16bit(get(), 0)); }
/** * Constructs a class file including no members. * * @param isInterface * true if this is an interface. false if this is a class. * @param classname * a fully-qualified class name * @param superclass * a fully-qualified super class name */ public ClassFile(boolean isInterface, String classname, String superclass) { major = MAJOR_VERSION; minor = 0; // JDK 1.3 or later constPool = new ConstPool(classname); thisClass = constPool.getThisClassInfo(); if (isInterface) accessFlags = AccessFlag.INTERFACE | AccessFlag.ABSTRACT; else accessFlags = AccessFlag.SUPER; initSuperclass(superclass); interfaces = null; fields = new ArrayList(); methods = new ArrayList(); thisclassname = classname; attributes = new ArrayList(); attributes.add(new SourceFileAttribute(constPool, getSourcefileName(thisclassname))); }