Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ClassParser


     *                  represents the class that is being requested. That check
     *                  should be done by ClassFileLoader.
     */
    public BCELClassFile(InputStream is, String file_name) throws IOException {
        logger.entering(myClassName, "<init>(InputStream, String)", file_name); // NOI18N
        jc = new ClassParser(is, file_name).parse();
    }
View Full Code Here


    /**
     * @param file_path Absolute path to the .class file.
     */
    public BCELClassFile(String file_path) throws IOException {
        logger.entering(myClassName, "<init>(String)", file_path); // NOI18N
        jc = new ClassParser(file_path).parse();
    }
View Full Code Here

        }

    }

    private static void nullBCELAdapt(final byte[] b) throws IOException {
        JavaClass jc = new ClassParser(new ByteArrayInputStream(b),
                "class-name").parse();
        ClassGen cg = new ClassGen(jc);
        ConstantPoolGen cp = cg.getConstantPool();
        Method[] ms = cg.getMethods();
        for (int k = 0; k < ms.length; ++k) {
View Full Code Here

        JavaClass javaClass = null;
        String classFileName = classInfo.getName().replace('.', '/') + ".class";
        try {
            InputStream classStream = loader.getResourceAsStream(classFileName);
            ClassParser classParser = new ClassParser(classStream, classFileName);
            javaClass = classParser.parse();
        } catch (IOException e) {
            throw new WrappedRuntimeException(e);
        }

        List attributes = getAspectAttributes(javaClass);
View Full Code Here

        byte[] b = new byte[(int) new File(filename).length()];
        InputStream in = new FileInputStream(filename);
        new DataInputStream(in).readFully(b);
        in.close();

        ClassParser parser = new ClassParser(new ByteArrayInputStream(b), filename);
        JavaClass jc = parser.parse();
        boolean changed;
        changed = downgrade(jc);

        if (changed)
        {
View Full Code Here

     */
    public static final StringBuffer getConstants(byte[] bytes)
        throws IOException {
        final StringBuffer sb = new StringBuffer();
        final ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
        final ClassParser parser = new ClassParser(bis, "");
        final JavaClass javaClass = parser.parse();
        final Field[] fields = javaClass.getFields();
        for (int i = 0; i < fields.length; i++) {
            final Field field = fields[i];
            if (field != null) {
                final ConstantValue cv = field.getConstantValue();
View Full Code Here

     * be satisfied
     */
    public FullAnalyzer() {
        // force BCEL classes to load now
        try {
            new ClassParser("force");
        } catch (IOException e) {
            // ignore
        }
    }
View Full Code Here

                    if (container == null) {
                        continue;
                    }
                    containers.put(container, container);

                    ClassParser parser = null;
                    if (container.getName().endsWith(".class")) {
                        parser = new ClassParser(container.getPath());
                    } else {
                        parser = new ClassParser(container.getPath(),
                            classname.replace('.', '/') + ".class");
                    }

                    JavaClass javaClass = parser.parse();
                    DescendingVisitor traverser
                         = new DescendingVisitor(javaClass, dependencyVisitor);
                    traverser.visit();
                } catch (IOException ioe) {
                    // ignore
View Full Code Here

     * be satisfied
     */
    public AncestorAnalyzer() {
        // force BCEL classes to load now
        try {
            new ClassParser("force");
        } catch (IOException e) {
            // ignore
        }
    }
View Full Code Here

                    if (container == null) {
                        continue;
                    }
                    containers.put(container, container);

                    ClassParser parser = null;
                    if (container.getName().endsWith(".class")) {
                        parser = new ClassParser(container.getPath());
                    } else {
                        parser = new ClassParser(container.getPath(),
                            classname.replace('.', '/') + ".class");
                    }

                    JavaClass javaClass = parser.parse();
                    String[] interfaces = javaClass.getInterfaceNames();
                    for (int i = 0; i < interfaces.length; ++i) {
                        String interfaceName = interfaces[i];
                        if (!dependencies.containsKey(interfaceName)) {
                            nextAnalyze.put(interfaceName, interfaceName);
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.ClassParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.