Class ZipSourceLocation

java.lang.Object
org.fife.rsta.ac.java.buildpath.ZipSourceLocation
All Implemented Interfaces:
SourceLocation

public class ZipSourceLocation extends Object implements SourceLocation
Represents source inside a zip or jar file. The source can be either in a "src/" subfolder, or at the root level of the archive. This class is useful for the JDK or other libraries that come with a src.zip file (src.jar on OS X).
Version:
1.0
  • Field Details

    • archive

      private File archive
  • Constructor Details

    • ZipSourceLocation

      public ZipSourceLocation(String archive)
      Constructor.
      Parameters:
      archive - The archive containing the source. This should be an absolute path to ensure correctness.
    • ZipSourceLocation

      public ZipSourceLocation(File archive)
      Constructor.
      Parameters:
      archive - The archive containing the source.
  • Method Details

    • getCompilationUnit

      public CompilationUnit getCompilationUnit(ClassFile cf) throws IOException
      Returns an AST for the specified class file.
      Specified by:
      getCompilationUnit in interface SourceLocation
      Parameters:
      cf - The class file to grab the AST for.
      Returns:
      The AST, or null if it cannot be found.
      Throws:
      IOException - If an IO error occurs.
    • getLocationAsString

      public String getLocationAsString()
      Returns a string representation of this source location. For locations on disk such as zip files or directories, this should be the full path to the resource.
      Specified by:
      getLocationAsString in interface SourceLocation
      Returns:
      The location of this source as a string, or null if it is not an accessible location.