Package com.subhajit.common.util.CommonUtils

Examples of com.subhajit.common.util.CommonUtils.IResource


      progress.setRange(0, files.size());
      for (final File file : files) {
        progress.increment(1, file.getName());
        Iterator<IResource> resourceIt = repository.getResources(file);
        while (resourceIt.hasNext()) {
          final IResource resource = resourceIt.next();
          if (resource.isDirectory()) {
            continue;
          }
          if (resource.getName().endsWith(".class")) {
            index++;
            completionService.submit(new Callable<Set<File>>() {
              public Set<File> call() throws Exception {
                final String className = resource.getName()
                    .substring(
                        0,
                        resource.getName().lastIndexOf(
                            ".class")).replace('/',
                        '.');
                Set<File> usedFiles = new HashSet<File>();
                for (String usedClass : repository.findClass(
                    className).getUsedClasses()) {
View Full Code Here


            }

            // Examine the resources to check if they are inner or
            // anonymous classes of "className".
            while (resources.hasNext()) {
              IResource next = resources.next();
              String name = next.getName();
              if (name.endsWith(".class")) {
                String testClassName = name.substring(0,
                    name.lastIndexOf(".class")).replace(
                    '\\', '/').replace('/', '.');
                if (testClassName.indexOf('$') != -1
View Full Code Here

                        throw new UnsupportedOperationException(
                                "Unsupported file: neither directory nor name-ends-with \".jar\"");
                    }
                    for (Iterator<IResource> it = parser.iterator(); it
                            .hasNext();) {
                        IResource resource = it.next();
                        if (resource.isDirectory()) {
                            continue;
                        }
                        if (resource.getName().endsWith(".class")) {
                            final String className = resource.getName()
                                    .substring(
                                            0,
                                            resource.getName().lastIndexOf(
                                                    ".class"))
                                    .replace('/', '.');
                            if (className.startsWith(barePackageName + ".")) {
                                ret.add(className);
                            }
View Full Code Here

    } else {
      // Now copy the resources from the source paths.
      for (File sourcePath : sourcePaths) {
        for (Iterator<IResource> it = new DirectoryParser(sourcePath)
            .iterator(); it.hasNext();) {
          IResource resource = it.next();
          if (!resource.isDirectory()) {
            if (!resource.getName().endsWith(".java")) {
              File destFile = new File(outputDirectory, resource
                  .getName());
              FileUtils.mkdirs(destFile.getParentFile());
              FileUtils.copyFile(new File(sourcePath, resource
                  .getName()), destFile);
            }
          }
        }
      }
View Full Code Here

      zOut = new ZipOutputStream(new BufferedOutputStream(
          new FileOutputStream(outputZipFile)));
      for (File sourcePath : sourcePaths) {
        for (Iterator<IResource> it = new DirectoryParser(sourcePath)
            .iterator(); it.hasNext();) {
          IResource resource = it.next();
          if (!resource.isDirectory()) {
            if (entries.contains(resource.getName())) {
              continue;
            } else {
              entries.add(resource.getName());
            }
            ZipEntry destEntry = new ZipEntry(resource.getName());
            zOut.putNextEntry(destEntry);
            InputStream in = null;
            try {
              in = new BufferedInputStream(resource
                  .getInputStream());
              StreamUtils.copyStream(in, zOut);
              zOut.flush();
            } finally {
              if (in != null) {
View Full Code Here

            } else if (file.isDirectory()) {
              parser = new DirectoryParser(file);
            }
            for (Iterator<IResource> it = parser
                .iterator(); it.hasNext();) {
              IResource resource = it.next();
              if (!resource.isDirectory()
                  && resource.getName().endsWith(".class")
                  && resource.getName().indexOf("$") == -1) {
                String className = resource.getName()
                    .substring(
                        0,
                        resource.getName().lastIndexOf(
                            ".class")).replace('/',
                        '.');

                try {
                  classLoader.loadClass(className)
View Full Code Here

            } else {
              parser = new CommonUtils.DirectoryParser(file);
            }
            Iterator<IResource> it = parser.iterator();
            while (it.hasNext()) {
              IResource resource = it.next();
              if (!resource.isDirectory()) {
                InputStream in = null;
                try {
                  in = resource.getInputStream();
                  ret.put(resource.getName(), StreamUtils
                      .readFully(in));
                } finally {
                  if (in != null) {
                    in.close();
                  }
View Full Code Here

              .getNextSubmitted();
          if (!entry.getKey()) {
            break;
          }
          while (entry.getValue().hasNext()) {
            IResource resource = entry.getValue().next();
            if (!resource.isDirectory()
                && resource.getName().endsWith(".class")) {
              List<File> files = map.get(resource.getName());
              if (files == null) {
                files = new ArrayList<File>();
                map.put(resource.getName(), files);
              }
              files.add(resource.getFile());
            }
          }
        } catch (ExecutionException exc) {
          if (exc.getCause() instanceof InterruptedException) {
            throw (InterruptedException) exc.getCause();
View Full Code Here

              .getNextSubmitted();
          if (!entry.getKey()) {
            break;
          }
          while (entry.getValue().hasNext()) {
            IResource resource = entry.getValue().next();
            if (!resource.isDirectory()
                && resource.getName().endsWith(".class")) {
              List<File> files = map.get(resource.getName());
              if (files == null) {
                files = new ArrayList<File>();
                map.put(resource.getName(), files);
              }
              files.add(resource.getFile());
            }
          }
        } catch (ExecutionException exc) {
          if (exc.getCause() instanceof InterruptedException) {
            throw (InterruptedException) exc.getCause();
View Full Code Here

              .getNextSubmitted();
          if (!entry.getKey()) {
            break;
          }
          while (entry.getValue().hasNext()) {
            IResource resource = entry.getValue().next();
            String resourceName = resource.getName();
            if (!resource.isDirectory()
                && classNamesSet.contains(resourceName)) {
              List<File> files = map.get(resourceName);
              if (files == null) {
                files = new ArrayList<File>();
                map.put(resourceName, files);
              }
              files.add(resource.getFile());
            }
          }
        } catch (ExecutionException exc) {
          if (exc.getCause() instanceof InterruptedException) {
            throw (InterruptedException) exc.getCause();
View Full Code Here

TOP

Related Classes of com.subhajit.common.util.CommonUtils.IResource

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.