FileDocCategorySizeDatePackage
FileResourceIterator.javaAPI DocApache Ant 1.703097Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.resources

FileResourceIterator

public class FileResourceIterator extends Object implements Iterator
Iterator of FileResources from filenames.
since
Ant 1.7

Fields Summary
private File
basedir
private String[]
files
private int
pos
Constructors Summary
public FileResourceIterator()
Construct a new FileResourceIterator.


             
      
    
public FileResourceIterator(File f)
Construct a new FileResourceIterator relative to the specified base directory.

param
f the base directory of this instance.

        basedir = f;
    
public FileResourceIterator(File f, String[] s)
Construct a new FileResourceIterator over the specified filenames, relative to the specified base directory.

param
f the base directory of this instance.
param
s the String[] of filenames.

        this(f);
        addFiles(s);
    
Methods Summary
public voidaddFiles(java.lang.String[] s)
Add an array of filenames to this FileResourceIterator.

param
s the filenames to add.

        int start = (files == null) ? 0 : files.length;
        String[] newfiles = new String[start + s.length];
        if (start > 0) {
            System.arraycopy(files, 0, newfiles, 0, start);
        }
        files = newfiles;
        System.arraycopy(s, 0, files, start, s.length);
    
public booleanhasNext()
Find out whether this FileResourceIterator has more elements.

return
whether there are more Resources to iterate over.

        return pos < files.length;
    
public java.lang.Objectnext()
Get the next element from this FileResourceIterator.

return
the next Object.

        return nextResource();
    
public FileResourcenextResource()
Convenience method to return the next resource.

return
the next File.

        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        return new FileResource(basedir, files[pos++]);
    
public voidremove()
Not implemented.

        throw new UnsupportedOperationException();