Package aQute.lib.zip
Class ZipUtil
- java.lang.Object
-
- aQute.lib.zip.ZipUtil
-
public class ZipUtil extends java.lang.Object
This class provides utilities to work with zip files. http://www.opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra. fld
-
-
Constructor Summary
Constructors Constructor Description ZipUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
cleanPath(java.lang.String path)
Clean the input path to avoid ZipSlip issues.static long
getModifiedTime(java.util.zip.ZipEntry entry)
static boolean
isCompromised(java.lang.String path)
static void
setModifiedTime(java.util.zip.ZipEntry entry, long utc)
-
-
-
Method Detail
-
getModifiedTime
public static long getModifiedTime(java.util.zip.ZipEntry entry)
-
setModifiedTime
public static void setModifiedTime(java.util.zip.ZipEntry entry, long utc)
-
cleanPath
public static java.lang.String cleanPath(java.lang.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 benull
.- Returns:
- Cleansed ZipEntry path.
- Throws:
java.io.UncheckedIOException
- If the entry used '..' relative paths to back up past the start of the path.
-
isCompromised
public static boolean isCompromised(java.lang.String path)
-
-