public class ZipTools
extends java.lang.Object
- public String[] getZipEntries(String zipFilename)
- public ZipObject[] readAllFromZip(String zipFilename)
- public ZipObject readFromZip(String zipFilename)
- ZipObject readFromZip(String zipFilename, String zipEntryName)
- public void writeToZip(String zipFilename, InputStream from)
- public void writeToZip(String zipFilename, String entryName, InputStream from)
- public void writeToZip(String zipFilename, ZipObject[] zipObjects)
- public ZipObject[] unzip(InputStream in)
- public byte[] zip(ZipObject[] in)
- public byte[] zip(ZipObject[] in, String comment)
- public byte[] zip(ZipObject[] in, int level)
- public byte[] zip(ZipObject[] in, String comment, int level)
Constructor and Description |
---|
ZipTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getZipEntries(java.lang.String zipFilename)
Retrieves a list of all entries in the packed file.
|
static ZipObject[] |
readAllFromZip(java.lang.String zipFilename)
Extracts the entry with the given name from the given zipfile.
|
static ZipObject |
readFromZip(java.lang.String zipFilename)
Extracts the first entry from the given zipfile.
|
static ZipObject |
readFromZip(java.lang.String zipFilename,
java.lang.String zipEntryName)
Extracts the entry with the given name from the given zipfile.
|
static ZipObject[] |
unzip(java.io.InputStream in)
Uncompresses the incoming data stream.
|
static void |
writeToZip(java.lang.String zipFilename,
java.io.InputStream from)
Packs the given input to the output file
|
static void |
writeToZip(java.lang.String zipFilename,
java.lang.String entryName,
java.io.InputStream from)
Packs the given input to an entry with the given name in the output file
|
static void |
writeToZip(java.lang.String zipFilename,
ZipObject[] zipObjects)
Packs the given objects in the output file.
|
static byte[] |
zip(ZipObject[] zipObjects)
Compresses the incoming data.
|
static byte[] |
zip(ZipObject[] zipObjects,
int level)
Compresses the incoming data.
|
static byte[] |
zip(ZipObject[] zipObjects,
java.lang.String comment)
Compresses the incoming data.
|
static byte[] |
zip(ZipObject[] zipObjects,
java.lang.String comment,
int level)
Compresses the incoming data.
|
public static ZipObject readFromZip(java.lang.String zipFilename)
zipFilename
- The packed file.public static ZipObject readFromZip(java.lang.String zipFilename, java.lang.String zipEntryName)
zipFilename
- The packed file.zipEntryName
- The name of the entry to extract.public static ZipObject[] unzip(java.io.InputStream in)
in
- The compressed data streampublic static byte[] zip(ZipObject[] zipObjects)
zipObjects
- The objects containing data and the names of the zip entries.public static byte[] zip(ZipObject[] zipObjects, java.lang.String comment)
zipObjects
- The objects containing data and the names of the zip entries.comment
- The documentation of the compressed stream.public static byte[] zip(ZipObject[] zipObjects, int level)
zipObjects
- The objects containing data and the names of the zip entries.level
- The compression level (0-9)public static byte[] zip(ZipObject[] zipObjects, java.lang.String comment, int level)
zipObjects
- The objects containing data and the names of the zip entries.comment
- The documentation of the compressed stream.level
- The compression level (0-9)public static ZipObject[] readAllFromZip(java.lang.String zipFilename)
zipFilename
- The packed file.public static void writeToZip(java.lang.String zipFilename, ZipObject[] zipObjects)
zipFilename
- The file to write the packed data.zipObjects
- The objects to pack.public static void writeToZip(java.lang.String zipFilename, java.lang.String entryName, java.io.InputStream from)
zipFilename
- The file to write the packed data.entryName
- The name of the entry to use in the packed file.from
- The stream to read the data from.public static void writeToZip(java.lang.String zipFilename, java.io.InputStream from)
zipFilename
- The file to write the packed data.from
- The stream to read the data from.public static java.lang.String[] getZipEntries(java.lang.String zipFilename)
zipFilename
- The name of the zipfile to search for.