java.lang.Object
io.quarkus.fs.util.ZipUtils
- Author:
- Alexey Loubyansky
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyFromZip(Path source, Path target) static FileSystemcreateNewReproducibleZipFileSystem(Path zipFile, Instant entryTime) Create a new ZIP FileSystem, ensuring reproducibility by sorting the files before adding them and enforcing the timestamps.static FileSystemCreate a new ZIP FileSystem, ensuring better reproducibility by enforcing entry timestamps for every entry.static FileSystemnewFileSystem(URI uri, Map<String, Object> env) This call is not thread safe, a single of FileSystem can be created for the provided uri until it is closed.static FileSystemnewFileSystem(Path path) Constructs a new FileSystem to access the contents of a zip as a file system.static FileSystemnewFileSystem(Path path, ClassLoader classLoader) Deprecated.static FileSystemstatic FileSystemIn this version, callers can set whatever parameters they like for the FileSystem.static URIstatic voidstatic OutputStreamwrapForJDK8232879(OutputStream original) Deprecated, for removal: This API element is subject to removal in a future version.Do not wrap the OutputStream, it is not needed anymore.static voidstatic voidzipReproducibly(Path src, Path zipFile, Instant entryTime) Create a new ZIP file, ensuring reproducibility by sorting the files before adding them and enforcing the timestamps.
-
Constructor Details
-
ZipUtils
public ZipUtils()
-
-
Method Details
-
unzip
- Throws:
IOException
-
toZipUri
- Throws:
IOException
-
copyFromZip
- Throws:
IOException
-
zip
- Throws:
IOException
-
newZip
- Throws:
IOException
-
newZip
In this version, callers can set whatever parameters they like for the FileSystem. Note that these values always take precedence over whatever the library itself sets.- Throws:
IOException
-
newFileSystem
This call is not thread safe, a single of FileSystem can be created for the provided uri until it is closed.- Parameters:
uri- The uri to the zip file.env- Env map.- Returns:
- A new FileSystem.
- Throws:
IOException- in case of a failure
-
newFileSystem
Constructs a new FileSystem to access the contents of a zip as a file system.- Parameters:
path- The zip file.- Returns:
- A new FileSystem instance
- Throws:
IOException- in case of a failure
-
newFileSystem
@Deprecated public static FileSystem newFileSystem(Path path, ClassLoader classLoader) throws IOException Deprecated.UsenewFileSystem(Path). Providing a classLoader makes no difference, since the ZipFileSystemProvider is part of the FileSystemProvider.installedProviders() list. No classloader needs to be searched for a custom FileSystemProvider.This call is thread safe, a new FS is created for each invocation.- Parameters:
path- The zip file.classLoader- the classloader to locate the appropriate FileSystemProvider to open the path- Returns:
- A new FileSystem instance
- Throws:
IOException- in case of a failure
-
wrapForJDK8232879
@Deprecated(forRemoval=true, since="0.11.0") public static OutputStream wrapForJDK8232879(OutputStream original) Deprecated, for removal: This API element is subject to removal in a future version.Do not wrap the OutputStream, it is not needed anymore.This is a hack to get past the JDK-8232879 issue which causes CRC errors when writing out data to (jar) files using ZipFileSystem.Made into a no-op given the JDK issue has been fixed.
- Parameters:
original- The original outputstream which will be wrapped into a new outputstream that delegates to this one.- Returns:
-
zipReproducibly
Create a new ZIP file, ensuring reproducibility by sorting the files before adding them and enforcing the timestamps.- Throws:
IOException
-
createNewReproducibleZipFileSystem
public static FileSystem createNewReproducibleZipFileSystem(Path zipFile, Instant entryTime) throws IOException Create a new ZIP FileSystem, ensuring reproducibility by sorting the files before adding them and enforcing the timestamps.- Throws:
IOException
-
createNewReproducibleZipFileSystem
public static FileSystem createNewReproducibleZipFileSystem(Path zipFile, Map<String, Object> env, Instant entryTime) throws IOExceptionCreate a new ZIP FileSystem, ensuring better reproducibility by enforcing entry timestamps for every entry.- Throws:
IOException
-
newFileSystem(Path).