Package gov.nasa.jpf.classfile

Examples of gov.nasa.jpf.classfile.ClassFile


      JarEntry entry = jar.getJarEntry(fileName);
      if (entry != null) {
        try {
          logger.fine("Loaded " + className + " from jar file " + jar.getName());
          byte[] classBytes = Util.getClassBytes(jar.getInputStream(entry));
          ClassFile cf = new ClassFile(className, classBytes);
          return new UnregisteredClassInfo(cf);
        } catch (IOException e) {
          logger.warning(e.getMessage());
          return null;
        } catch (ClassFileException e) {
View Full Code Here


        String peerName = name.replace('/', '.');
        System.out.println(peerName);
       
        try {
          byte[] classBytes = Util.getClassBytes(jar.getInputStream(entry));
          ClassFile cf = new ClassFile(peerName, classBytes);
          peers.add(new UnregisteredClassInfo(cf));
        } catch (IOException e) {
          logger.warning("error while loading class from " +
              jar.getName() + "\n" + e.getMessage());
        } catch (ClassFileException e) {
View Full Code Here

    String fileName = className.replace('.', '/') + ".class";
    try {
      JarEntry entry = jar.getJarEntry(fileName);
      if (entry != null) {
        byte[] classBytes = Util.getClassBytes(jar.getInputStream(entry));
        ClassFile cf = new ClassFile(className, classBytes);
        return new UnregisteredClassInfo(cf);
      }
    } catch (IOException e) {
      logger.warning("error while loading class " + className +
          " from jar file " + jar.getName() + "\n" + e.getMessage());
View Full Code Here

        try {
          // to avoid things like .ClassName for classes in the default package
          String name = (!"".equals(baseName))? baseName + "." : "";
          name += fileName.substring(fileName.lastIndexOf('.'));
          byte[] classBytes = Util.getClassBytes(new FileInputStream(f));
          ClassFile cf = new ClassFile(name, classBytes);
          ClassInfo ci = new UnregisteredClassInfo(cf);
          // FIXME it would be better to be able to perform this check earlier
          if(matchesSpecs(ci.getName(), specs)) {
            classInfos.add(ci);
          }
View Full Code Here

          // FIXME: check if on Windows the file separator inside jar files
          // is / or \
          name = name.substring(0, name.lastIndexOf('.')).replace('/', '.');
          if(matchesSpecs(name, specs)) {
            byte[] classBytes = Util.getClassBytes(jar.getInputStream(entry));
            ClassFile cf = new ClassFile(name, classBytes);
            classInfos.add(new UnregisteredClassInfo(cf));
          }
        }
      }
    } catch (IOException e) {
View Full Code Here

    fileNames[fileNames.length-1] += ".class";
    File file = getFile(f, 0, fileNames);
    if(file != null) {
      try {
        byte[] data = Util.getClassBytes(new FileInputStream(file));
        ClassFile cf = new ClassFile(className, data);
//        return new UnregisteredClassInfo(cf);
        return new ClassInfo(cf, rnd.nextInt(1000));
      } catch (FileNotFoundException e) {
        logger.warning(e.getMessage());
      } catch (IOException e) {
View Full Code Here

    try {
      JarFile jar = new JarFile(f);
      JarEntry entry = jar.getJarEntry(fileName);
      if (entry != null) {
        byte[] classBytes = Util.getClassBytes(jar.getInputStream(entry));
        ClassFile cf = new ClassFile(className, classBytes);
        return new UnregisteredClassInfo(cf);
      }
    } catch (IOException e) {
      logger.warning("error while loading class " + className +
          " from jar file " + f + "\n" + e.getMessage());
View Full Code Here

  public void parse(String path) throws ClassFileException {
    classinfo = new ClassInfo();
    classinfo.setLocation(path);
    classinfo.setLayer(inferLayer(path));
    classinfo.setProject(inferProject(path));
    ClassFile cfile = new ClassFile(path);
    cfile.parse(this);
  }
View Full Code Here

      throw new ClassFileNotFoundException("Class not found in classpath: "
              + clsname);
    }
    classinfo.setLocation(source);
    classinfo.setLayer(inferLayer(clsname, classpath));
    ClassFile cfile = new ClassFile(classpath.getClassData(clsname));
    cfile.parse(this);
  }
View Full Code Here

   *
   * @param cfdata Byte array containing classfile data.
   */
  public void parse(byte[] cfdata) throws ClassFileException {
    classinfo = new ClassInfo();
    ClassFile cfile = new ClassFile(cfdata);
    cfile.parse(this);
  }
View Full Code Here

TOP

Related Classes of gov.nasa.jpf.classfile.ClassFile

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.