Codota Logo
org.scannotation.archiveiterator
Code IndexAdd Codota to your IDE (free)

How to use org.scannotation.archiveiterator

Best Java code snippets using org.scannotation.archiveiterator (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: banq/jdonframework

public static StreamIterator create(URL url, Filter filter) throws IOException {
  String urlString = url.toString();
  if (urlString.endsWith("!/")) {
    urlString = urlString.substring(4);
    urlString = urlString.substring(0, urlString.length() - 2);
    url = new URL(urlString);
  }
  if (!urlString.endsWith("/")) {
    return new JarIterator(url.openStream(), filter);
  } else {
    DirectoryIteratorFactory factory = registry.get(url.getProtocol());
    if (factory == null)
      throw new IOException("Unable to scan directory of protocol: " + url.getProtocol());
    return factory.create(url, filter);
  }
}
origin: banq/jdonframework

public void scanArchives(URL... urls) {
  for (URL url : urls) {
    Filter filter = new Filter() {
      public boolean accepts(String filename) {
        if (filename.endsWith(".class")) {
          if (filename.startsWith("/"))
            filename = filename.substring(1);
          if (!ignoreScan(filename.replace('/', '.')))
            return true;
          // System.out.println("IGNORED: " + filename);
        }
        return false;
      }
    };
    try {
      StreamIterator it = IteratorFactory.create(url, filter);
      InputStream stream;
      while ((stream = it.next()) != null)
        scanClass(stream);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
origin: net.sf.scannotation/scannotation

public InputStream next()
{
 if (closed || (next == null && !initial)) return null;
 setNext();
 if (next == null) return null;
 return new InputStreamWrapper(jar);
}
origin: net.sf.scannotation/scannotation

/**
* Scan a url that represents an "archive"  this is a classpath directory or jar file
*
* @param urls variable list of URLs to scan as archives
* @throws IOException
*/
public void scanArchives(URL... urls) throws IOException
{
 for (URL url : urls)
 {
   Filter filter = new Filter()
   {
    public boolean accepts(String filename)
    {
      if (filename.endsWith(".class"))
      {
       if (filename.startsWith("/")) filename = filename.substring(1);
       if (!ignoreScan(filename.replace('/', '.'))) return true;
       //System.out.println("IGNORED: " + filename);
      }
      return false;
    }
   };
   StreamIterator it = IteratorFactory.create(url, filter);
   InputStream stream;
   while ((stream = it.next()) != null) scanClass(stream);
 }
}
origin: net.sf.scannotation/scannotation

  public StreamIterator create(URL url, Filter filter) throws IOException
  {
   File f = new File(url.getPath());
   if (f.isDirectory())
   {
     return new FileIterator(f, filter);
   }
   else
   {
     return new JarIterator(url.openStream(), filter);
   }
  }
}
origin: net.sf.scannotation/scannotation

protected static void create(List list, File dir, Filter filter) throws Exception
{
 File[] files = dir.listFiles();
 for (int i = 0; i < files.length; i++)
 {
   if (files[i].isDirectory())
   {
    create(list, files[i], filter);
   }
   else
   {
    if (filter == null || filter.accepts(files[i].getAbsolutePath()))
    {
      list.add(files[i]);
    }
   }
 }
}
origin: net.sf.scannotation/scannotation

private void setNext()
{
 initial = true;
 try
 {
   if (next != null) jar.closeEntry();
   next = null;
   do
   {
    next = jar.getNextJarEntry();
   } while (next != null && (next.isDirectory() || (filter == null || !filter.accepts(next.getName()))));
   if (next == null)
   {
    close();
   }
 }
 catch (IOException e)
 {
   throw new RuntimeException("failed to browse jar", e);
 }
}
origin: stackoverflow.com

 DirectoryIteratorFactory factory = registry.get(url.getProtocol());
if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol());
return factory.create(url, filter);
origin: de.juplo/scannotation

protected static void create(List list, File dir, Filter filter) throws Exception
{
  create(list, dir, filter, dir.getCanonicalPath());
}
protected static void create(List list, File dir, Filter filter, String prefix) throws Exception
origin: de.juplo/scannotation

  public static StreamIterator create(URL url, Filter filter) throws IOException
  {
   String urlString = url.toString();
   if (urlString.endsWith("!/"))
   {
     urlString = urlString.substring(4);
     urlString = urlString.substring(0, urlString.length() - 2);
     url = new URL(urlString);
   }


   if (!urlString.endsWith("/"))
   {
     return new JarIterator(url.openStream(), filter);
   }
   else
   {
     DirectoryIteratorFactory factory = registry.get(url.getProtocol());
     if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol());
     return factory.create(url, filter);
   }
  }
}
origin: de.juplo/scannotation

StreamIterator it = IteratorFactory.create(url, filter);
while ((stream = it.next()) != null) scanClass(stream);
origin: de.juplo/scannotation

  public StreamIterator create(URL url, Filter filter) throws IOException
  {
    // See http://weblogs.java.net/blog/2007/04/25/how-convert-javaneturl-javaiofile
    File f;
    try
    {
      f = new File(url.toURI());
    }
    catch (URISyntaxException e)
    {
      f = new File(url.getPath());
    }

    if (f.isDirectory())
   {
     return new FileIterator(f, filter);
   }
   else
   {
     return new JarIterator(url.openStream(), filter);
   }
  }
}
origin: de.juplo/scannotation

public InputStream next()
{
 if (closed || (next == null && !initial)) return null;
 setNext();
 if (next == null) return null;
 return new InputStreamWrapper(jar);
}
origin: de.juplo/scannotation

protected static void create(List list, File dir, Filter filter, String prefix) throws Exception
{
 File[] files = dir.listFiles();
 for (int i = 0; i < files.length; i++)
 {
   if (files[i].isDirectory())
   {
    create(list, files[i], filter, prefix);
   }
   else
   {
     String path = files[i].getCanonicalPath();
     String relativePath = path.substring(prefix.length() + 1);
     if (File.separatorChar == '\\')
       relativePath = relativePath.replace('\\', '/');
     if (filter == null || filter.accepts(relativePath))
    {
      list.add(files[i]);
    }
   }
 }
}
origin: de.juplo/scannotation

private void setNext()
{
 initial = true;
 try
 {
   if (next != null) jar.closeEntry();
   next = null;
   do
   {
    next = jar.getNextJarEntry();
   } while (next != null && (next.isDirectory() || (filter == null || !filter.accepts(next.getName()))));
   if (next == null)
   {
    close();
   }
 }
 catch (IOException e)
 {
   throw new RuntimeException("failed to browse jar", e);
 }
}
origin: net.sf.scannotation/scannotation

public FileIterator(File file, Filter filter)
{
 files = new ArrayList();
 try
 {
   create(files, file, filter);
 }
 catch (Exception e)
 {
   throw new RuntimeException(e);
 }
}
origin: net.sf.scannotation/scannotation

  public static StreamIterator create(URL url, Filter filter) throws IOException
  {
   String urlString = url.toString();
   if (urlString.endsWith("!/"))
   {
     urlString = urlString.substring(4);
     urlString = urlString.substring(0, urlString.length() - 2);
     url = new URL(urlString);
   }


   if (!urlString.endsWith("/"))
   {
     return new JarIterator(url.openStream(), filter);
   }
   else
   {
     DirectoryIteratorFactory factory = registry.get(url.getProtocol());
     if (factory == null) throw new IOException("Unable to scan directory of protocol: " + url.getProtocol());
     return factory.create(url, filter);
   }
  }
}
origin: com.khubla.pragmatach/pragmatach-framework

private static void scanURLs(URL[] urls, ServletContext servletContext) throws PragmatachException {
 try {
   if (null != servletContext) {
    final PluginFilter pluginFilter = new PluginFilter();
    if ((null != urls) && (urls.length > 0)) {
      for (final URL url : urls) {
       if (null != url) {
         final StreamIterator streamIterator = IteratorFactory.create(url, pluginFilter);
         InputStream inputStream;
         while (null != (inputStream = streamIterator.next())) {
          final PluginDescriptor plugin = new PluginDescriptor(url, inputStream, servletContext);
          logger.info("Found plugin: " + plugin.getName());
          plugins.put(plugin.getName(), plugin);
          inputStream.close();
         }
       }
      }
    }
   }
 } catch (final Exception e) {
   throw new PragmatachException("Exception in scanURLs", e);
 }
}
origin: de.juplo/scannotation

public FileIterator(File file, Filter filter)
{
 files = new ArrayList();
 try
 {
   create(files, file, filter);
 }
 catch (Exception e)
 {
   throw new RuntimeException(e);
 }
}
protected static void create(List list, File dir, Filter filter) throws Exception
org.scannotation.archiveiterator

Most used classes

  • DirectoryIteratorFactory
  • StreamIterator
  • IteratorFactory
  • JarIterator
  • FileIterator
  • InputStreamWrapper
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now