Package org.gatein.common.jar

Examples of org.gatein.common.jar.JarEntryInfo


         // We need to create a fake jar entry to mimic this behavior
         rootEntry = new JarEntry("/");
      }

      // Get the root entry
      JarEntryInfo rootEntryInfo = new JarEntryInfo(rootEntry);

      // The entries we will browse
      JarInfo jarInfo = new JarInfo(jarFile);

      boolean enabled = true;

      //
      Stack stack = new Stack(jarURL, rootEntryInfo);
      for (Iterator<JarEntryInfo> i = jarInfo.entries(); i.hasNext();)
      {
         JarEntryInfo entryInfo = (JarEntryInfo)i.next();

         // Only consider descendant of the root or root itself
         if (entryInfo.equals(rootEntryInfo) || entryInfo.isDescendantOf(rootEntryInfo))
         {
            List<String> relPath;
            // The relative path from the root
            if (rootEntryInfo.size() > 1){
               relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1, entryInfo.size());
            }
            else
            {
               relPath = entryInfo.getNames();
            }

            // Enter intermediate dirs
            while (stack.size() < relPath.size() - 1 && enabled)
            {
               String name = (String)relPath.get(stack.size());
               stack.push(name, true);
               URL url = stack.getURL();
               boolean visit = filter == null || filter.acceptDir(url);
               if (visit)
               {
                  visitor.startDir(url, name);
               }
               else
               {
                  enabled = false;
               }
            }

            // Leave intermediate dirs
            while (stack.size() > relPath.size() - 1)
            {
               URL url = stack.getURL();
               Stack.Entry entry = stack.pop();
               if (enabled)
               {
                  String name = entry.name;
                  visitor.endDir(url, name);
               }
               enabled = true;
            }

            //
            if (enabled)
            {
               if (entryInfo.isDirectory())
               {
                  String name = (String)relPath.get(relPath.size() - 1);
                  stack.push(name, true);
                  URL url = stack.getURL();
                  boolean visit = filter == null || filter.acceptDir(url);
View Full Code Here


         // We need to create a fake jar entry to mimic this behavior
         rootEntry = new JarEntry("/");
      }

      // Get the root entry
      JarEntryInfo rootEntryInfo = new JarEntryInfo(rootEntry);

      // The entries we will browse
      JarInfo jarInfo = new JarInfo(jarFile);

      boolean enabled = true;

      //
      Stack stack = new Stack(jarURL, rootEntryInfo);
      for (Iterator i = jarInfo.entries(); i.hasNext();)
      {
         JarEntryInfo entryInfo = (JarEntryInfo)i.next();

         // Only consider descendant of the root or root itself
         if (entryInfo.equals(rootEntryInfo) || entryInfo.isDescendantOf(rootEntryInfo))
         {
            List relPath;
            // The relative path from the root
            if (rootEntryInfo.size() > 1){
               relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1, entryInfo.size());
            }
            else
            {
               relPath = entryInfo.getNames();
            }

            // Enter intermediate dirs
            while (stack.size() < relPath.size() - 1 && enabled)
            {
               String name = (String)relPath.get(stack.size());
               stack.push(name, true);
               URL url = stack.getURL();
               boolean visit = filter == null || filter.acceptDir(url);
               if (visit)
               {
                  visitor.startDir(url, name);
               }
               else
               {
                  enabled = false;
               }
            }

            // Leave intermediate dirs
            while (stack.size() > relPath.size() - 1)
            {
               URL url = stack.getURL();
               Stack.Entry entry = stack.pop();
               if (enabled)
               {
                  String name = entry.name;
                  visitor.endDir(url, name);
               }
               enabled = true;
            }

            //
            if (enabled)
            {
               if (entryInfo.isDirectory())
               {
                  String name = (String)relPath.get(relPath.size() - 1);
                  stack.push(name, true);
                  URL url = stack.getURL();
                  boolean visit = filter == null || filter.acceptDir(url);
View Full Code Here

TOP

Related Classes of org.gatein.common.jar.JarEntryInfo

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.