public class ZipUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ZipUtil.CopyStreamCopier
streamCopier that simply copies the stream without modification.
|
static class |
ZipUtil.PrefixStripper
Strips a prefix from input
|
static interface |
ZipUtil.renamer
Interface for renaming a file
|
static interface |
ZipUtil.streamCopier
Interface for copying a stream from input to output.
|
Constructor and Description |
---|
ZipUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
copyStream(java.io.InputStream inputStream,
java.io.OutputStream outputStream) |
static void |
extractZip(java.lang.String path,
java.io.File dest)
Extracts all contents of the file to the destination directory
|
static void |
extractZip(java.lang.String path,
java.io.File dest,
java.io.FilenameFilter filter,
ZipUtil.renamer rename,
ZipUtil.streamCopier copier)
Extract the zip file to the destination, optionally only the matching files and renaming the files
|
static void |
extractZip(java.lang.String path,
java.io.File dest,
java.lang.String prefix)
Extracts all contents that match a certain prefix
|
static void |
extractZip(java.lang.String path,
java.io.File dest,
java.lang.String prefix,
java.lang.String stripPrefix)
Extract the zip file to the destination, optionally only the matching files and renaming the files
|
static void |
extractZip(java.lang.String path,
java.io.File dest,
java.lang.String prefix,
java.lang.String stripPrefix,
ZipUtil.streamCopier copier)
Extract the zip file to the destination, optionally only the matching files and renaming the files
|
static void |
extractZip(java.lang.String path,
java.io.File dest,
java.lang.String prefix,
ZipUtil.renamer rename,
ZipUtil.streamCopier copier)
Extract the zip file to the destination, optionally only the matching files and renaming the files
|
static void |
extractZipFile(java.lang.String path,
java.io.File dest,
java.lang.String fileName)
Extracts a single entry from the zip
|
public static void extractZip(java.lang.String path, java.io.File dest) throws java.io.IOException
path
- zip file pathdest
- destination directoryjava.io.IOException
- on io errorpublic static void extractZip(java.lang.String path, java.io.File dest, java.lang.String prefix) throws java.io.IOException
path
- zip file pathdest
- destination directoryprefix
- prefix of contents to extractjava.io.IOException
- on io errorpublic static void extractZipFile(java.lang.String path, java.io.File dest, java.lang.String fileName) throws java.io.IOException
path
- zip file pathdest
- destination directoryfileName
- specific filepath to extractjava.io.IOException
- on io errorpublic static void extractZip(java.lang.String path, java.io.File dest, java.lang.String prefix, java.lang.String stripPrefix) throws java.io.IOException
path
- zip file pathdest
- destination directory to contain filesprefix
- match files within the zip if they have this prefix path, or null selects all filesstripPrefix
- rename files by removing this prefix if they have it, or null doesn't rename filesjava.io.IOException
- on io errorpublic static void extractZip(java.lang.String path, java.io.File dest, java.lang.String prefix, java.lang.String stripPrefix, ZipUtil.streamCopier copier) throws java.io.IOException
path
- zip file pathdest
- destination directory to contain filesprefix
- match files within the zip if they have this prefix path, or null selects all filesstripPrefix
- rename files by removing this prefix if they have it, or null doesn't rename filescopier
- copierjava.io.IOException
- on io errorpublic static void extractZip(java.lang.String path, java.io.File dest, java.lang.String prefix, ZipUtil.renamer rename, ZipUtil.streamCopier copier) throws java.io.IOException
path
- zip file pathdest
- destination directory to contain filesprefix
- match files within the zip if they have this prefix path, or null selects all filesrename
- renamer instancecopier
- streamCopier instancejava.io.IOException
- on io errorpublic static void extractZip(java.lang.String path, java.io.File dest, java.io.FilenameFilter filter, ZipUtil.renamer rename, ZipUtil.streamCopier copier) throws java.io.IOException
path
- zip file pathdest
- destination directory to contain filesfilter
- filter to select matching filesrename
- renamer to usecopier
- streamCopier to usejava.io.IOException
- on io errorpublic static void copyStream(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException