org.apache.tools.ant.types
Class ZipScanner

java.lang.Object
  |
  +--org.apache.tools.ant.DirectoryScanner
        |
        +--org.apache.tools.ant.types.ZipScanner
All Implemented Interfaces:
FileScanner

public class ZipScanner
extends DirectoryScanner

ZipScanner accesses the pattern matching algorithm in DirectoryScanner, which are protected methods that can only be accessed by subclassing. This implementation of FileScanner defines getIncludedFiles to return only the Zip File which is being scanned, not the matching Zip entries. Arguably, it should return the matching entries, however this would complicate existing code which assumes that FileScanners return a set of file system files that can be accessed directly.

Author:
Don Ferguson don@bea.com

Field Summary
protected  java.io.File srcFile
          The zip file which should be scanned.
 
Fields inherited from class org.apache.tools.ant.DirectoryScanner
basedir, DEFAULTEXCLUDES, dirsExcluded, dirsIncluded, dirsNotIncluded, excludes, filesExcluded, filesIncluded, filesNotIncluded, haveSlowResults, includes
 
Constructor Summary
ZipScanner()
           
 
Method Summary
 java.lang.String[] getIncludedDirectories()
          Returns an empty list of directories to create.
 java.lang.String[] getIncludedFiles()
          Returns the zip file itself, not the matching entries within the zip file.
 void init()
          Initialize DirectoryScanner data structures.
 boolean match(java.lang.String path)
          Matches a jar entry against the includes/excludes list, normalizing the path separator.
 void setSrc(java.io.File srcFile)
          Sets the srcFile for scanning.
 
Methods inherited from class org.apache.tools.ant.DirectoryScanner
addDefaultExcludes, couldHoldIncluded, getBasedir, getExcludedDirectories, getExcludedFiles, getNotIncludedDirectories, getNotIncludedFiles, isExcluded, isIncluded, match, matchPath, matchPatternStart, scan, scandir, setBasedir, setBasedir, setExcludes, setIncludes, slowScan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

srcFile

protected java.io.File srcFile
The zip file which should be scanned.
Constructor Detail

ZipScanner

public ZipScanner()
Method Detail

setSrc

public void setSrc(java.io.File srcFile)
Sets the srcFile for scanning. This is the jar or zip file that is scanned for matching entries.
Parameters:
srcFile - the (non-null) zip file name for scanning

getIncludedFiles

public java.lang.String[] getIncludedFiles()
Returns the zip file itself, not the matching entries within the zip file. This keeps the uptodate test in the Zip task simple; otherwise we'd need to treat zip filesets specially.
Overrides:
getIncludedFiles in class DirectoryScanner
Returns:
the source file from which entries will be extracted.

getIncludedDirectories

public java.lang.String[] getIncludedDirectories()
Returns an empty list of directories to create.
Overrides:
getIncludedDirectories in class DirectoryScanner
Following copied from class: org.apache.tools.ant.DirectoryScanner
Returns:
the names of the directories

init

public void init()
Initialize DirectoryScanner data structures.

match

public boolean match(java.lang.String path)
Matches a jar entry against the includes/excludes list, normalizing the path separator.
Parameters:
path - the (non-null) path name to test for inclusion
Returns:
true if the path should be included false otherwise.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.