Class ZipArchiveAnalyzer<F extends BaseElementForest<E>,​E extends BaseElement<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.

    • Field Detail

      • matchPatterns

        protected final List<Pattern> matchPatterns
    • Constructor Detail

      • ZipArchiveAnalyzer

        public ZipArchiveAnalyzer​(ApiAnalyzer<E> apiAnalyzer,
                                  API api,
                                  List<Pattern> matchPatterns)
        Parameters:
        apiAnalyzer - the api analyzer for which this archive analyzer is created
        api - the API this analyzer analyzes
        matchPatterns - the match patterns for files looked for in the zip file
    • Method Detail

      • 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 in ZipArchiveAnalyzer base implementation. If the returned elements contain any sub-elements, they need to be added as children though.
        Parameters:
        a - the archive containing the entry
        entry - 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