FileDocCategorySizeDatePackage
ZipFileSet.javaAPI DocApache Ant 1.704521Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types

ZipFileSet

public class ZipFileSet extends ArchiveFileSet
A ZipFileSet is a FileSet with extra attributes useful in the context of Zip/Jar tasks. A ZipFileSet extends FileSets with the ability to extract a subset of the entries of a Zip file for inclusion in another Zip file. It also includes a prefix attribute which is prepended to each entry in the output Zip file. Since ant 1.6 ZipFileSet can be defined with an id and referenced in packaging tasks

Fields Summary
private String
encoding
Constructors Summary
public ZipFileSet()
Constructor for ZipFileSet


        
      
        super();
    
protected ZipFileSet(FileSet fileset)
Constructor using a fileset arguement.

param
fileset the fileset to use

        super(fileset);
    
protected ZipFileSet(ZipFileSet fileset)
Constructor using a zipfileset arguement.

param
fileset the zipfileset to use

        super(fileset);
        encoding = fileset.encoding;
    
Methods Summary
private voidcheckZipFileSetAttributesAllowed()
A check attributes for zipFileSet. If there is a reference, and it is a ZipFileSet, the zip fileset attributes cannot be used.

        if (getProject() == null
            || (isReference()
                && (getRefid().getReferencedObject(
                        getProject())
                    instanceof ZipFileSet))) {
            checkAttributesAllowed();
        }
    
public java.lang.Objectclone()
Return a ZipFileSet that has the same properties as this one.

return
the cloned zipFileSet

        if (isReference()) {
            return ((ZipFileSet) getRef(getProject())).clone();
        } else {
            return super.clone();
        }
    
public java.lang.StringgetEncoding()
Get the encoding used for this ZipFileSet.

return
String encoding.
since
Ant 1.7

        if (isReference()) {
            AbstractFileSet ref = getRef(getProject());
            if (ref instanceof ZipFileSet) {
                return ((ZipFileSet) ref).getEncoding();
            } else {
                return null;
            }
        }
        return encoding;
    
protected AbstractFileSetgetRef(org.apache.tools.ant.Project p)
A ZipFileset accepts another ZipFileSet or a FileSet as reference FileSets are often used by the war task for the lib attribute

param
p the project to use
return
the abstract fileset instance

        dieOnCircularReference(p);
        Object o = getRefid().getReferencedObject(p);
        if (o instanceof ZipFileSet) {
            return (AbstractFileSet) o;
        } else if (o instanceof FileSet) {
            ZipFileSet zfs = new ZipFileSet((FileSet) o);
            configureFileSet(zfs);
            return zfs;
        } else {
            String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset or a fileset";
            throw new BuildException(msg);
        }
    
protected ArchiveScannernewArchiveScanner()
Return a new archive scanner based on this one.

return
a new ZipScanner with the same encoding as this one.

        ZipScanner zs = new ZipScanner();
        zs.setEncoding(encoding);
        return zs;
    
public voidsetEncoding(java.lang.String enc)
Set the encoding used for this ZipFileSet.

param
enc encoding as String.
since
Ant 1.7

        checkZipFileSetAttributesAllowed();
        this.encoding = enc;