5d3b44cf2a32fb3cc9b1f109d68fb08db8babf8e
[scannotation] / src / main / java / org / scannotation / classpath / FileProtocolIteratorFactory.java
1 package org.scannotation.classpath;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.net.URL;
6
7 /**
8  * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
9  * @version $Revision: 1 $
10  */
11 public class FileProtocolIteratorFactory implements DirectoryIteratorFactory
12 {
13
14    public StreamIterator create(URL url, Filter filter) throws IOException
15    {
16       File f = new File(url.getPath());
17       if (f.isDirectory())
18       {
19          return new FileIterator(f, filter);
20       }
21       else
22       {
23          return new JarIterator(url.openStream(), filter);
24       }
25    }
26 }