Package org.apache.tools.ant.types
Class ArchiveScanner
- java.lang.Object
- 
- org.apache.tools.ant.DirectoryScanner
- 
- org.apache.tools.ant.types.ArchiveScanner
 
 
- 
- All Implemented Interfaces:
- FileScanner,- ResourceFactory,- SelectorScanner
 - Direct Known Subclasses:
- TarScanner,- ZipScanner
 
 public abstract class ArchiveScanner extends DirectoryScanner ArchiveScanner 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 the matching archive entries.- Since:
- Ant 1.7
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.io.FilesrcFileThe archive file which should be scanned.- 
Fields inherited from class org.apache.tools.ant.DirectoryScannerbasedir, DEFAULTEXCLUDES, dirsDeselected, dirsExcluded, dirsIncluded, dirsNotIncluded, DOES_NOT_EXIST_POSTFIX, errorOnMissingDir, everythingIncluded, excludes, filesDeselected, filesExcluded, filesIncluded, filesNotIncluded, haveSlowResults, includes, isCaseSensitive, MAX_LEVELS_OF_SYMLINKS, selectors
 
- 
 - 
Constructor SummaryConstructors Constructor Description ArchiveScanner()
 - 
Method SummaryModifier and Type Method Description protected abstract voidfillMapsFromArchive(Resource archive, java.lang.String encoding, java.util.Map<java.lang.String,Resource> fileEntries, java.util.Map<java.lang.String,Resource> matchFileEntries, java.util.Map<java.lang.String,Resource> dirEntries, java.util.Map<java.lang.String,Resource> matchDirEntries)Fills the file and directory maps with resources read from the archive.java.lang.String[]getIncludedDirectories()Returns the names of the directories which matched at least one of the include patterns and none of the exclude patterns.intgetIncludedDirsCount()Override parent implementation.java.lang.String[]getIncludedFiles()Returns the names of the files which matched at least one of the include patterns and none of the exclude patterns.intgetIncludedFilesCount()Override parent implementation.ResourcegetResource(java.lang.String name)Get the named Resource.voidinit()Initialize DirectoryScanner data structures.booleanmatch(java.lang.String path)Matches a jar entry against the includes/excludes list, normalizing the path separator.voidscan()Don't scan when we have no zipfile.voidsetEncoding(java.lang.String encoding)Sets encoding of file names.voidsetErrorOnMissingArchive(boolean errorOnMissingArchive)Sets whether an error is thrown if an archive does not exist.voidsetSrc(java.io.File srcFile)Sets the srcFile for scanning.voidsetSrc(Resource src)Sets the src for scanning.protected static java.lang.StringtrimSeparator(java.lang.String s)Remove trailing slash if present.- 
Methods inherited from class org.apache.tools.ant.DirectoryScanneraddDefaultExclude, addDefaultExcludes, addExcludes, clearResults, couldHoldIncluded, getBasedir, getDefaultExcludes, getDeselectedDirectories, getDeselectedFiles, getExcludedDirectories, getExcludedFiles, getNotFollowedSymlinks, getNotIncludedDirectories, getNotIncludedFiles, isCaseSensitive, isEverythingIncluded, isExcluded, isFollowSymlinks, isIncluded, isSelected, match, match, matchPath, matchPath, matchPatternStart, matchPatternStart, removeDefaultExclude, resetDefaultExcludes, scandir, setBasedir, setBasedir, setCaseSensitive, setErrorOnMissingDir, setExcludes, setFollowSymlinks, setIncludes, setMaxLevelsOfSymlinks, setSelectors, slowScan
 
- 
 
- 
- 
- 
Method Detail- 
setErrorOnMissingArchivepublic void setErrorOnMissingArchive(boolean errorOnMissingArchive) Sets whether an error is thrown if an archive does not exist.- Parameters:
- errorOnMissingArchive- true if missing archives cause errors, false if not.
- Since:
- Ant 1.8.0
 
 - 
scanpublic void scan() Don't scan when we have no zipfile.- Specified by:
- scanin interface- FileScanner
- Overrides:
- scanin class- DirectoryScanner
- Since:
- Ant 1.7
 
 - 
setSrcpublic 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) archive file name for scanning
 
 - 
setSrcpublic void setSrc(Resource src) Sets the src for scanning. This is the jar or zip file that is scanned for matching entries.- Parameters:
- src- the (non-null) archive resource
 
 - 
setEncodingpublic void setEncoding(java.lang.String encoding) Sets encoding of file names.- Parameters:
- encoding- the encoding format
- Since:
- Ant 1.6
 
 - 
getIncludedFilespublic java.lang.String[] getIncludedFiles() Returns the names of the files which matched at least one of the include patterns and none of the exclude patterns. The names are relative to the base directory.- Specified by:
- getIncludedFilesin interface- FileScanner
- Overrides:
- getIncludedFilesin class- DirectoryScanner
- Returns:
- the names of the files which matched at least one of the include patterns and none of the exclude patterns.
 
 - 
getIncludedFilesCountpublic int getIncludedFilesCount() Override parent implementation.- Overrides:
- getIncludedFilesCountin class- DirectoryScanner
- Returns:
- count of included files.
- Since:
- Ant 1.7
 
 - 
getIncludedDirectoriespublic java.lang.String[] getIncludedDirectories() Returns the names of the directories which matched at least one of the include patterns and none of the exclude patterns. The names are relative to the base directory.- Specified by:
- getIncludedDirectoriesin interface- FileScanner
- Overrides:
- getIncludedDirectoriesin class- DirectoryScanner
- Returns:
- the names of the directories which matched at least one of the include patterns and none of the exclude patterns.
 
 - 
getIncludedDirsCountpublic int getIncludedDirsCount() Override parent implementation.- Overrides:
- getIncludedDirsCountin class- DirectoryScanner
- Returns:
- count of included directories.
- Since:
- Ant 1.7
 
 - 
initpublic void init() Initialize DirectoryScanner data structures.
 - 
matchpublic 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:
- trueif the path should be included- falseotherwise.
 
 - 
getResourcepublic Resource getResource(java.lang.String name) Get the named Resource.- Specified by:
- getResourcein interface- ResourceFactory
- Overrides:
- getResourcein class- DirectoryScanner
- Parameters:
- name- path name of the file sought in the archive
- Returns:
- the resource
- Since:
- Ant 1.5.2
 
 - 
fillMapsFromArchiveprotected abstract void fillMapsFromArchive(Resource archive, java.lang.String encoding, java.util.Map<java.lang.String,Resource> fileEntries, java.util.Map<java.lang.String,Resource> matchFileEntries, java.util.Map<java.lang.String,Resource> dirEntries, java.util.Map<java.lang.String,Resource> matchDirEntries) Fills the file and directory maps with resources read from the archive.- Parameters:
- archive- the archive to scan.
- encoding- encoding used to encode file names inside the archive.
- fileEntries- Map (name to resource) of non-directory resources found inside the archive.
- matchFileEntries- Map (name to resource) of non-directory resources found inside the archive that matched all include patterns and didn't match any exclude patterns.
- dirEntries- Map (name to resource) of directory resources found inside the archive.
- matchDirEntries- Map (name to resource) of directory resources found inside the archive that matched all include patterns and didn't match any exclude patterns.
 
 - 
trimSeparatorprotected static final java.lang.String trimSeparator(java.lang.String s) Remove trailing slash if present.- Parameters:
- s- the file name to trim.
- Returns:
- the trimmed file name.
 
 
- 
 
-