FileDocCategorySizeDatePackage
DirSet.javaAPI DocApache Ant 1.703312Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.types

DirSet

public class DirSet extends AbstractFileSet implements ResourceCollection
Subclass as hint for supporting tasks that the included directories instead of files should be used.
since
Ant 1.5

Fields Summary
Constructors Summary
public DirSet()
Constructor for DirSet.

        super();
    
protected DirSet(DirSet dirset)
Constructor for DirSet, with DirSet to shallowly clone.

param
dirset the dirset to clone.

        super(dirset);
    
Methods Summary
public java.lang.Objectclone()
Return a DirSet that has the same basedir and same patternsets as this one.

return
the cloned dirset.

        if (isReference()) {
            return ((DirSet) getRef(getProject())).clone();
        } else {
            return super.clone();
        }
    
public booleanisFilesystemOnly()
Always returns true.

return
true indicating that all elements will be FileResources.
since
Ant 1.7

        return true;
    
public java.util.Iteratoriterator()
Fulfill the ResourceCollection contract.

return
an Iterator of Resources.
since
Ant 1.7

        if (isReference()) {
            return ((DirSet) getRef(getProject())).iterator();
        }
        return new FileResourceIterator(getDir(getProject()),
            getDirectoryScanner(getProject()).getIncludedDirectories());
    
public intsize()
Fulfill the ResourceCollection contract.

return
number of elements as int.
since
Ant 1.7

        if (isReference()) {
            return ((DirSet) getRef(getProject())).size();
        }
        return getDirectoryScanner(getProject()).getIncludedDirsCount();
    
public java.lang.StringtoString()
Returns included directories as a list of semicolon-separated paths.

return
a String of included directories.

        DirectoryScanner ds = getDirectoryScanner(getProject());
        String[] dirs = ds.getIncludedDirectories();
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < dirs.length; i++) {
            if (i > 0) {
                sb.append(';");
            }
            sb.append(dirs[i]);
        }
        return sb.toString();