Class ZipFileSlice

java.lang.Object
nonapi.io.github.classgraph.fastzipfilereader.ZipFileSlice
Direct Known Subclasses:
LogicalZipFile

public class ZipFileSlice extends Object
A zipfile slice (a sub-range of bytes within a PhysicalZipFile.
  • Field Details

    • parentZipFileSlice

      private final ZipFileSlice parentZipFileSlice
      The parent slice, or null if this is the toplevel slice (the whole zipfile).
    • physicalZipFile

      protected final PhysicalZipFile physicalZipFile
      The underlying physical zipfile.
    • pathWithinParentZipFileSlice

      private final String pathWithinParentZipFileSlice
      For the toplevel zipfile slice, the zipfile path; For nested slices, the name/path of the zipfile entry.
    • slice

      public Slice slice
      The Slice containing the zipfile.
  • Constructor Details

  • Method Details

    • isAcceptedAndNotRejected

      public boolean isAcceptedAndNotRejected(AcceptReject.AcceptRejectLeafname jarAcceptReject)
      Check whether this zipfile slice and all of its parent slices are accepted and not rejected in the jarfile accept/reject criteria.
      Parameters:
      jarAcceptReject - the jar accept/reject criteria
      Returns:
      true if this zipfile slice and all of its parent slices are accepted and not rejected in the jarfile accept/reject criteria.
    • getParentZipFileSlice

      public ZipFileSlice getParentZipFileSlice()
      Get the parent ZipFileslice, or return null if this is a toplevel slice (i.e. if this slice wraps an entire physical zipfile).
      Returns:
      the parent ZipFileslice, or null if this is a toplevel slice.
    • getPathWithinParentZipFileSlice

      public String getPathWithinParentZipFileSlice()
      Get the name of the slice (either the entry name/path within the parent zipfile slice, or the path of the physical zipfile if this slice is a toplevel slice (i.e. if this slice wraps an entire physical zipfile).
      Returns:
      the name of the slice.
    • appendPath

      private void appendPath(StringBuilder buf)
      Recursively append the path in top down ancestral order.
      Parameters:
      buf - the buf to append the path to
    • getPath

      public String getPath()
      Get the path of this zipfile slice, e.g. "/path/to/jarfile.jar!/nestedjar1.jar".
      Returns:
      the path of this zipfile slice.
    • getPhysicalFile

      public File getPhysicalFile()
      Get the physical File that this ZipFileSlice is a slice of.
      Returns:
      the physical File that this ZipFileSlice is a slice of, or null if this file was downloaded from a URL directly to RAM.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object