Package org.revapi.base
Class ZipArchiveAnalyzer<F extends BaseElementForest<E>,E extends BaseElement<E>>
- java.lang.Object
-
- org.revapi.base.BaseArchiveAnalyzer<F,E>
-
- org.revapi.base.BaseEagerLoadingArchiveAnalyzer<F,E>
-
- org.revapi.base.ZipArchiveAnalyzer<F,E>
-
- All Implemented Interfaces:
ArchiveAnalyzer<E>
public abstract class ZipArchiveAnalyzer<F extends BaseElementForest<E>,E extends BaseElement<E>> extends BaseEagerLoadingArchiveAnalyzer<F,E>
This is a base class for archive analyzers that need to search for files in a zipped archive.This implementation is only useful for API analyzers that process the files in the ZIP archives one-by-one in some manner. E.g. they might be looking for some concrete files in the zip or can compose the API from looking at the individual files. For analyzers that need to process the files as a whole, this might not be the ideal superclass to inherit from.
This implementation ignores the
supplementary archives
of the API.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.revapi.base.BaseEagerLoadingArchiveAnalyzer
BaseEagerLoadingArchiveAnalyzer.FullForestContext
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Pattern>
matchPatterns
-
Constructor Summary
Constructors Constructor Description ZipArchiveAnalyzer(ApiAnalyzer<E> apiAnalyzer, API api, List<Pattern> matchPatterns)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Set<E>
createElements(Archive archive)
Scans the archive and returns the elements within.protected abstract Set<E>
createElements(Archive a, ZipEntry entry, InputStream data)
Creates elements out of the provided data.-
Methods inherited from class org.revapi.base.BaseEagerLoadingArchiveAnalyzer
discoverElements, discoverRoots, preAnalyze
-
Methods inherited from class org.revapi.base.BaseArchiveAnalyzer
addTo, analyze, getApi, getApiAnalyzer, newElementForest, postAnalyze, prune
-
-
-
-
Constructor Detail
-
ZipArchiveAnalyzer
public ZipArchiveAnalyzer(ApiAnalyzer<E> apiAnalyzer, API api, List<Pattern> matchPatterns)
- Parameters:
apiAnalyzer
- the api analyzer for which this archive analyzer is createdapi
- the API this analyzer analyzesmatchPatterns
- the match patterns for files looked for in the zip file
-
-
Method Detail
-
createElements
protected Set<E> createElements(Archive archive)
Description copied from class:BaseEagerLoadingArchiveAnalyzer
Scans the archive and returns the elements within. Each of the returned elements is supposed to have a fully realized hierarchy of children.- Specified by:
createElements
in classBaseEagerLoadingArchiveAnalyzer<F extends BaseElementForest<E>,E extends BaseElement<E>>
- Parameters:
archive
- the archive to analyze- Returns:
- a set of root elements found in the archive (with children initialized, too)
-
createElements
protected abstract Set<E> createElements(Archive a, @Nullable ZipEntry entry, InputStream data) throws IOException
Creates elements out of the provided data. These element don't have to be placed in any kind of hierarchy - that will be done automatically inZipArchiveAnalyzer
base implementation. If the returned elements contain any sub-elements, they need to be added as children though.- Parameters:
a
- the archive containing the entryentry
- the zip file entry, can be null if parsing data of the whole file (in case it is not a ZIP file)data
- the data of the entry- Returns:
- the parsed elements
- Throws:
IOException
-
-