Class SourceZip


  • public class SourceZip
    extends Object
    A collection of Java source files and its sub-directories located in a ZIP or JAR file on the file system. Files can be parsed with a callback.
    • Constructor Detail

      • SourceZip

        public SourceZip​(Path zipPath)
        Create a new ZIP parser. An instance of JavaParser with the default ParserConfiguration will be used to parse the ZIP.
        Parameters:
        zipPath - The absolute path of ZIP file to parse.
      • SourceZip

        public SourceZip​(Path zipPath,
                         ParserConfiguration configuration)
        Create a new ZIP parser. An instance of JavaParser with the given configuration will be used to parse the ZIP.
        Parameters:
        zipPath - The absolute path of ZIP file to parse.
        configuration - The configuration to initiate the default parser with.
    • Method Detail

      • parse

        public List<Pair<Path,​ParseResult<CompilationUnit>>> parse()
                                                                  throws IOException
        Tries to parse all '.java' files in the ZIP located at this SourceZip's path and returns the parse results in a list.
        Returns:
        A list of path-compilation unit pairs.
        Throws:
        IOException - If an error occurs while trying to parse the given source.
      • parse

        public SourceZip parse​(SourceZip.Callback callback)
                        throws IOException
        Tries to parse all '.java' files in the ZIP located at this SourceZip's path and returns the parse results in a list.
        Returns:
        A list of path-compilation unit pairs.
        Throws:
        IOException - If an error occurs while trying to parse the given source.
      • getZipPath

        public Path getZipPath()
        Get the path of the ZIP file to be parsed.
        Returns:
        The absolute path of this ZIP file.
      • getJavaParser

        @Deprecated
        public JavaParser getJavaParser()
        Deprecated.
        store ParserConfiguration now
      • setJavaParser

        @Deprecated
        public SourceZip setJavaParser​(JavaParser javaParser)
        Deprecated.
        store ParserConfiguration now
        Set the parser that is used for parsing by default.