Class SourceZip


  • public class SourceZip
    extends java.lang.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.
    • Field Detail

      • zipPath

        private final java.nio.file.Path zipPath
    • Constructor Detail

      • SourceZip

        public SourceZip​(java.nio.file.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​(java.nio.file.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 java.util.List<Pair<java.nio.file.Path,​ParseResult<CompilationUnit>>> parse()
                                                                                          throws java.io.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:
        java.io.IOException - If an error occurs while trying to parse the given source.
      • parse

        public SourceZip parse​(SourceZip.Callback callback)
                        throws java.io.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:
        java.io.IOException - If an error occurs while trying to parse the given source.
      • getZipPath

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