Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ClassParser


        }
        return ret;
    }

    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


                JarEntry entry = export.getKey();
                InputStream in = null;
                try
                {
                    in = jar.getInputStream(entry);
                    ClassParser parser = new ClassParser(in, entry.getName());
                    JavaClass c = parser.parse();
                    index.addEntry(c, rep, bundle, true);
                }
                finally
                {
                    if (in != null)
View Full Code Here

        Vertex jarVertex = singleOrDefault(((Vertex) data.getElement()).getVertices(Direction.BOTH, Ontology.EDGE_LABEL_JAR_CONTAINS, getAuthorizations()), null);

        String fileName = LumifyProperties.FILE_NAME.getPropertyValue(data.getElement());

        JavaClass javaClass = new ClassParser(in, fileName).parse();
        ConstantPoolGen constants = new ConstantPoolGen(javaClass.getConstantPool());

        Vertex classVertex = createClassVertex(javaClass, data);
        if (jarVertex != null) {
            getGraph().addEdge(jarVertex, classVertex, Ontology.EDGE_LABEL_JAR_CONTAINS, data.getProperty().getVisibility(), getAuthorizations());
View Full Code Here

            throw new RuntimeException(e);
        }
        try {
            for (Entry<String, byte[]> entry : rawclasses.entrySet()) {
                ByteArrayInputStream in = new ByteArrayInputStream(entry.getValue());
                ClassParser parser = new ClassParser(in, entry.getKey());
                javaclasses.put(entry.getKey(), new ClassGen(parser.parse()));
                in.close();
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

     *            the input stream from which to read the class file
     * @param fileName
     *            filename of the class file
     */
    public RepositoryClassParser(InputStream inputStream, String fileName) {
        classParser = new ClassParser(inputStream, fileName);
    }
View Full Code Here

     *
     * @param fileName
     *            name of the class file
     */
    public RepositoryClassParser(String fileName)  {
        classParser = new ClassParser(fileName);
    }
View Full Code Here

     *            name of a zip file containing the class
     * @param fileName
     *            name of the zip entry within the class
     */
    public RepositoryClassParser(String zipFile, String fileName) {
        classParser = new ClassParser(zipFile, fileName);
    }
View Full Code Here

  }

  byte[] nullAdaptClass (final InputStream is, final String name)
    throws Exception
  {
    JavaClass jc = new ClassParser(is, name + ".class").parse();
    ClassGen cg = new ClassGen(jc);
    ConstantPoolGen cp = cg.getConstantPool();
    Method[] ms = cg.getMethods();
    for (int j = 0; j < ms.length; ++j) {
      MethodGen mg = new MethodGen(ms[j], cg.getClassName(), cp);
View Full Code Here

  }

  byte[] counterAdaptClass (final InputStream is, final String name)
    throws Exception
  {
    JavaClass jc = new ClassParser(is, name + ".class").parse();
    ClassGen cg = new ClassGen(jc);
    ConstantPoolGen cp = cg.getConstantPool();
    if (!cg.isInterface()) {
      FieldGen fg = new FieldGen(ACC_PUBLIC, Type.getType("I"), "_counter", cp);
      cg.addField(fg.getField());
View Full Code Here

     */
    @Override
    public JavaClass analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException {
        try {
            ClassData classData = analysisCache.getClassAnalysis(ClassData.class, descriptor);
            JavaClass javaClass = new ClassParser(classData.getInputStream(), descriptor.toResourceName()).parse();

            // Make sure that the JavaClass object knows the repository
            // it was loaded from.
            javaClass.setRepository(Repository.getRepository());

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.