Package com.wavemaker.commons.zip
Class ZipArchive
- java.lang.Object
-
- com.wavemaker.commons.io.store.StoredResource
-
- com.wavemaker.commons.io.store.StoredFolder
-
- com.wavemaker.commons.zip.ZipArchive
-
public class ZipArchive extends StoredFolder
Adapter class that can be used present a zip file as aFolder.
-
-
Constructor Summary
Constructors Constructor Description ZipArchive(File zipFile)Create a newZipArchiveinstance from the specified zip file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.io.InputStreamcompress(Folder folder)Create aInputStreamcontaining a zip representation of the given folder.static voidcompress(Folder folder, File file)static java.io.InputStreamcompress(Folder folder, java.lang.String prefix)Create aInputStreamcontaining a zip representation of the given folder.static java.io.InputStreamcompress(Resources<?> resources)Create aInputStreamcontaining a zip representation of the given resources.static java.io.InputStreamcompress(Resources<?> resources, java.lang.String prefix)Create aInputStreamcontaining a zip representation of the given resources.protected FolderStoregetStore()static voidunpack(File file, Folder destination)Unzip the specified zip file into a folder.static voidunpack(java.io.InputStream inputStream, Folder destination)Unzip the specified input stream into a folder.-
Methods inherited from class com.wavemaker.commons.io.store.StoredFolder
copyContentsTo, copyTo, createIfMissing, delete, find, get, getExisting, getFile, getFolder, hasExisting, iterator, jail, list, moveContentsTo, moveTo, rename, toString
-
Methods inherited from class com.wavemaker.commons.io.store.StoredResource
createParentIfMissing, ensureExists, equals, exists, getLastModified, getName, getParent, getPath, hashCode, isModifiedAfter, isModifiedAfter, isModifiedBefore, isModifiedBefore, isRelativeTo, performOperation, toString, toStringRelativeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.wavemaker.commons.io.Resource
equals, exists, getLastModified, getName, getParent, isModifiedAfter, isModifiedAfter, isModifiedBefore, isModifiedBefore, isRelativeTo, performOperation, toString, toStringRelativeTo
-
-
-
-
Constructor Detail
-
ZipArchive
public ZipArchive(File zipFile)
Create a newZipArchiveinstance from the specified zip file.- Parameters:
zipFile- the zip file
-
-
Method Detail
-
getStore
protected FolderStore getStore()
- Specified by:
getStorein classStoredFolder
-
unpack
public static void unpack(File file, Folder destination)
Unzip the specified zip file into a folder.- Parameters:
file- the file to unzip (this must reference a zip file)destination- the destination folder
-
unpack
public static void unpack(java.io.InputStream inputStream, Folder destination)Unzip the specified input stream into a folder.- Parameters:
inputStream- the input stream to unzip (this must contain zip contents)destination- the destination folder
-
compress
public static java.io.InputStream compress(Folder folder)
Create aInputStreamcontaining a zip representation of the given folder.- Parameters:
folder- the folder to compress
-
compress
public static java.io.InputStream compress(Folder folder, java.lang.String prefix)
Create aInputStreamcontaining a zip representation of the given folder.- Parameters:
folder- the folder to compressprefix- an optional entry prefix. This allows a entries to be nested within a folder if required
-
compress
public static java.io.InputStream compress(Resources<?> resources)
Create aInputStreamcontaining a zip representation of the given resources.- Parameters:
resources- resources to compress
-
compress
public static java.io.InputStream compress(Resources<?> resources, java.lang.String prefix)
Create aInputStreamcontaining a zip representation of the given resources.- Parameters:
resources- resources to compressprefix- an optional entry prefix. This allows a entries to be nested within a folder if required
-
-