Package aQute.lib.zip
Class ZipUtil
- java.lang.Object
-
- aQute.lib.zip.ZipUtil
-
public class ZipUtil extends java.lang.ObjectThis class provides utilities to work with zip files. http://www.opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra. fld
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classZipUtil.State
-
Field Summary
Fields Modifier and Type Field Description private static java.util.TimeZonetz
-
Constructor Summary
Constructors Constructor Description ZipUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcleanPath(java.lang.String path)Clean the input path to avoid ZipSlip issues.static longgetModifiedTime(java.util.zip.ZipEntry entry)static booleanisCompromised(java.lang.String path)static voidsetModifiedTime(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)
-
-