Package aQute.lib.zip

Class ZipUtil

java.lang.Object
aQute.lib.zip.ZipUtil

public class ZipUtil extends Object
This class provides utilities to work with zip files. http://www.opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra. fld
  • Field Details

  • Constructor Details

    • ZipUtil

      public ZipUtil()
  • Method Details

    • getModifiedTime

      public static long getModifiedTime(ZipEntry entry)
    • setModifiedTime

      public static void setModifiedTime(ZipEntry entry, long utc)
    • cleanPath

      public static String cleanPath(String path)
      Clean the input path to avoid ZipSlip issues.

      All double '/', '.' and '..' path entries are resolved and removed. The returned path will have a '/' at the end when the input path has a '/' at the end. A leading '/' is stripped. An empty string is unmodified.

      Parameters:
      path - ZipEntry path. Must not be null.
      Returns:
      Cleansed ZipEntry path.
      Throws:
      UncheckedIOException - If the entry used '..' relative paths to back up past the start of the path.
    • isCompromised

      public static boolean isCompromised(String path)