public class ZIPUtils
extends java.lang.Object
Constructor and Description |
---|
ZIPUtils()
Constructor method for i18n purposes only.
|
Modifier and Type | Method and Description |
---|---|
static void |
collectZIPChildEntries(java.util.Vector<java.util.zip.ZipEntry> childs,
java.util.zip.ZipFile archive,
java.util.zip.ZipEntry entry)
Collects all child entries from a given ZIP/JAR file.
|
static boolean |
extractZipArchive(java.io.File zipfile,
java.io.File targetdir)
This extracts a given local ZIP/JAR file directly to a specified directory.
|
static boolean |
getAndExtractZipArchive(java.net.URL archive,
java.lang.String targetdir)
Downloads a given local ZIP/JAR file and extracts it to a specified directory.
|
static byte[] |
loadZIPEntryData(java.lang.String archive,
java.lang.String toload)
Does the loading of of a file entry within a JAR/ZIP file.
|
static java.io.InputStream |
openZIPEntryData(java.lang.String archive,
java.lang.String toload)
Does the loading of of a file entry within a JAR/ZIP file.
|
static boolean |
saveZIPEntry(java.util.zip.ZipFile archive,
java.util.zip.ZipEntry entry,
java.io.File target)
This method stores the content of a ZIP/JAR entry to a local file.
|
static void |
searchFilesInZIP(java.lang.String zipfile,
java.lang.String[] suffices,
java.util.Hashtable<java.lang.String,java.lang.String> candidates)
Searches the given JAR file (may be a ZIP file as well) for files with one of the propagated
suffices and adds the results to the container.
|
public ZIPUtils() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic static void searchFilesInZIP(java.lang.String zipfile, java.lang.String[] suffices, java.util.Hashtable<java.lang.String,java.lang.String> candidates)
Hashtable
container avoids one and the same file to be found more than once.
Errors are not reported by this method.
zipfile
- The JAR/ZIP file to search for filessuffices
- Searches all files with one of these sufficescandidates
- Container for search resultspublic static byte[] loadZIPEntryData(java.lang.String archive, java.lang.String toload)
archive
- The ZIP/JAR file to search the file to loadtoload
- The ZIP/JAR entry file to load data fromnull
in error casepublic static java.io.InputStream openZIPEntryData(java.lang.String archive, java.lang.String toload)
archive
- The ZIP/JAR file to search the file to loadtoload
- The ZIP/JAR entry file to load data fromnull
in error casepublic static void collectZIPChildEntries(java.util.Vector<java.util.zip.ZipEntry> childs, java.util.zip.ZipFile archive, java.util.zip.ZipEntry entry)
childs
- Container with child entriesarchive
- Archive to search for child entriesentry
- Parental ZIP/JAR file entrypublic static boolean saveZIPEntry(java.util.zip.ZipFile archive, java.util.zip.ZipEntry entry, java.io.File target)
archive
- ZIP/JAR archive to copy file fromentry
- Source to be copiedtarget
- The local file to store the contenttrue
, if saving workedpublic static boolean getAndExtractZipArchive(java.net.URL archive, java.lang.String targetdir)
ZipFile
has only constructor with File
parameter).
This method uses the name of the ZIP archive directly. Then the file is extracted.
archive
- ZIP/JAR archive to extract (URL)targetdir
- The local destination directorytrue
, if saving worked, false
elsepublic static boolean extractZipArchive(java.io.File zipfile, java.io.File targetdir)
ZipFile
has only constructor with File
parameter).
This method uses the name of the ZIP archive directly. Then the file is extracted.
zipfile
- ZIP/JAR archive to extracttargetdir
- The local destination directorytrue
, if saving worked, false
elseCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.