Package org.openpreservation.format.zip
Class Zips
java.lang.Object
org.openpreservation.format.zip.Zips
Utility class for working with
ZipArchive
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic final ZipEntryProcessor
extractorInstance
(Path root, boolean extractDirectories) Create aZipEntryProcessor
instance that processes the entries and extracts them to the supplied rootPath
.static final ZipProcessor.Factory
Create aZipProcessor.Factory
instance that can be used to createZipProcessor
instances.static final ZipArchiveCache
zipArchiveCacheInstance
(File file) Create aZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s.static final ZipArchiveCache
zipArchiveCacheInstance
(Path path) Create aZipArchiveCache
instance that caches the contents of the archive and provides access to thePath
s.static final ZipArchiveCache
zipArchiveCacheInstance
(ZipArchive archive, Map<String, byte[]> cache) Create aZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s.static final ZipEntry
zipEntryInstance
(String name, int size, int compressedSize, int crc32, int method, boolean isDirectory, byte[] extra)
-
Method Details
-
extractorInstance
Create aZipEntryProcessor
instance that processes the entries and extracts them to the supplied rootPath
.- Parameters:
root
- the rootPath
to extract the entries toextractDirectories
-true
to extract directories,false
to ignore them- Returns:
- a
ZipEntryProcessor
that processes the entries and extracts them to the supplied rootPath
-
factoryInstance
Create aZipProcessor.Factory
instance that can be used to createZipProcessor
instances.- Returns:
- a
ZipProcessor.Factory
-
zipArchiveCacheInstance
public static final ZipArchiveCache zipArchiveCacheInstance(ZipArchive archive, Map<String, byte[]> cache) Create aZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s.- Parameters:
archive
- theZipArchive
to cachecache
- the Map to use for caching- Returns:
- a
ZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s
-
zipArchiveCacheInstance
Create aZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s.- Parameters:
file
- theFile
to cache- Returns:
- a
ZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s - Throws:
IOException
-
zipArchiveCacheInstance
Create aZipArchiveCache
instance that caches the contents of the archive and provides access to thePath
s.- Parameters:
path
- thePath
to cache- Returns:
- a
ZipArchiveCache
instance that caches the contents of the archive and provides access to theInputStream
s - Throws:
IOException
-
zipEntryInstance
-