Class ZipScanner
java.lang.Object
org.apache.tools.ant.DirectoryScanner
org.apache.tools.ant.types.ArchiveScanner
org.apache.tools.ant.types.ZipScanner
- All Implemented Interfaces:
FileScanner, ResourceFactory, SelectorScanner
Scans zip archives for resources.
-
Field Summary
Fields inherited from class ArchiveScanner
srcFileFields inherited from class DirectoryScanner
basedir, DEFAULTEXCLUDES, dirsDeselected, dirsExcluded, dirsIncluded, dirsNotIncluded, DOES_NOT_EXIST_POSTFIX, errorOnMissingDir, everythingIncluded, excludes, filesDeselected, filesExcluded, filesIncluded, filesNotIncluded, haveSlowResults, includes, isCaseSensitive, MAX_LEVELS_OF_SYMLINKS, selectorsModifier and TypeFieldDescriptionprotected FileThe base directory to be scanned.protected static final String[]Deprecated.since 1.6.x.The directories which matched at least one include and no excludes but which a selector discarded.The directories which matched at least one include and at least one exclude.The directories which matched at least one include and no excludes and were selected.The directories which were found and did not match any includes.static final StringThe end of the exception message if something that should be there doesn't exist.protected booleanWhether a missing base directory is an error.protected booleanWhether or not everything tested so far has been included.protected String[]The patterns for the files to be excluded.The files which matched at least one include and no excludes and which a selector discarded.The files which matched at least one include and at least one exclude.The files which matched at least one include and no excludes and were selected.The files which did not match any includes or selectors.protected booleanWhether or not our results were built by a slow scan.protected String[]The patterns for the files to be included.protected booleanWhether or not the file system should be treated as a case sensitive one.static final intdefault value formaxLevelsOfSymlinksprotected FileSelector[]Selectors that will filter which files are in our candidate list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfillMapsFromArchive(Resource src, String encoding, Map<String, Resource> fileEntries, Map<String, Resource> matchFileEntries, Map<String, Resource> dirEntries, Map<String, Resource> matchDirEntries) Fills the file and directory maps with resources read from the archive.Methods inherited from class ArchiveScanner
getIncludedDirectories, getIncludedDirsCount, getIncludedFiles, getIncludedFilesCount, getResource, init, match, scan, setEncoding, setErrorOnMissingArchive, setSrc, setSrc, trimSeparatorModifier and TypeMethodDescriptionString[]Returns the names of the directories which matched at least one of the include patterns and none of the exclude patterns.intOverride parent implementation.String[]Returns the names of the files which matched at least one of the include patterns and none of the exclude patterns.intOverride parent implementation.getResource(String name) Get the named Resource.voidinit()Initialize DirectoryScanner data structures.booleanMatches a jar entry against the includes/excludes list, normalizing the path separator.voidscan()Don't scan when we have no zipfile.voidsetEncoding(String encoding) Sets encoding of file names.voidsetErrorOnMissingArchive(boolean errorOnMissingArchive) Sets whether an error is thrown if an archive does not exist.voidSets the srcFile for scanning.voidSets the src for scanning.protected static final StringRemove trailing slash if present.Methods inherited from class DirectoryScanner
addDefaultExclude, 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, slowScanModifier and TypeMethodDescriptionstatic booleanAdd a pattern to the default excludes unless it is already a default exclude.voidAdd default exclusions to the current exclusions set.voidaddExcludes(String[] excludes) Add to the list of exclude patterns to use.protected voidClear the result caches for a scan.protected booleancouldHoldIncluded(String name) Test whether or not a name matches the start of at least one include pattern.Return the base directory to be scanned.static String[]Get the list of patterns that should be excluded by default.String[]Return the names of the directories which were selected out and therefore not ultimately included.String[]Return the names of the files which were selected out and therefore not ultimately included.String[]Return the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns.String[]Return the names of the files which matched at least one of the include patterns and at least one of the exclude patterns.String[]Absolute paths of all symbolic links or Windows junctions that haven't been followed but would have been followed had followsymlinks been true or maxLevelsOfSymlinks been bigger.String[]Return the names of the directories which matched none of the include patterns.String[]Return the names of the files which matched none of the include patterns.booleanFind out whether include exclude patterns are matched in a case sensitive way.booleanReturn whether or not the scanner has included all the files or directories it has come across so far.protected booleanisExcluded(String name) Test whether or not a name matches against at least one exclude pattern.booleanGet whether or not a DirectoryScanner follows symbolic links or Windows junctions.protected booleanisIncluded(String name) Test whether or not a name matches against at least one include pattern.protected booleanisSelected(String name, File file) Test whether a file should be selected.static booleanTest whether or not a string matches against a pattern.protected static booleanTest whether or not a string matches against a pattern.protected static booleanTest whether or not a given path matches a given pattern.protected static booleanTest whether or not a given path matches a given pattern.protected static booleanmatchPatternStart(String pattern, String str) Test whether or not a given path matches the start of a given pattern up to the first "**".protected static booleanmatchPatternStart(String pattern, String str, boolean isCaseSensitive) Test whether or not a given path matches the start of a given pattern up to the first "**".static booleanRemove a string if it is a default exclude.static voidGo back to the hardwired default exclude patterns.protected voidScan the given directory for files and directories.voidsetBasedir(File basedir) Set the base directory to be scanned.voidsetBasedir(String basedir) Set the base directory to be scanned.voidsetCaseSensitive(boolean isCaseSensitive) Set whether or not include and exclude patterns are matched in a case sensitive way.voidsetErrorOnMissingDir(boolean errorOnMissingDir) Sets whether or not a missing base directory is an errorvoidsetExcludes(String[] excludes) Set the list of exclude patterns to use.voidsetFollowSymlinks(boolean followSymlinks) Set whether or not symbolic links or Windows junctions should be followed.voidsetIncludes(String[] includes) Set the list of include patterns to use.voidsetMaxLevelsOfSymlinks(int max) The maximum number of times a symbolic link or Windows junctions may be followed during a scan.voidsetSelectors(FileSelector[] selectors) Set the selectors that will select the filelist.protected voidslowScan()Top level invocation for a slow scan.
-
Constructor Details
-
ZipScanner
public ZipScanner()
-
-
Method Details
-
fillMapsFromArchive
protected void fillMapsFromArchive(Resource src, String encoding, Map<String, Resource> fileEntries, Map<String, Resource> matchFileEntries, Map<String, Resource> dirEntries, Map<String, Resource> matchDirEntries) Fills the file and directory maps with resources read from the archive.- Specified by:
fillMapsFromArchivein classArchiveScanner- Parameters:
src- 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.
-