Package hec.util
Class ZipUtility
java.lang.Object
hec.util.ZipUtility
A utility class that allows you to extract zip files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intextractZipFile(String zipFile, String outputDirectory) Extracts a given zip file to a directory passed in as an argument.static byte[]unzip(byte[] zipped) unzip the zipped byte[]static byte[]zip(byte[] unzipped) zip the unzipped byte[]
-
Field Details
-
SUCCESS
public static final int SUCCESS- See Also:
-
SETUP_OR_ZIP_EXCEPTION
public static final int SETUP_OR_ZIP_EXCEPTION- See Also:
-
IO_EXCEPTION
public static final int IO_EXCEPTION- See Also:
-
PARTIAL_EXTRACTION
public static final int PARTIAL_EXTRACTION- See Also:
-
-
Constructor Details
-
ZipUtility
public ZipUtility()
-
-
Method Details
-
extractZipFile
Extracts a given zip file to a directory passed in as an argument.- Parameters:
zipFile- a valid File location containing a Zip fileoutputDirectory- the location of the image, relative to the url argument- Returns:
- ZipUtility#SUCCESS if everything is successful ZipUtility#SETUP_OR_ZIP_EXCEPTION there was a ZipException ZipUtility#IO_EXCEPTION there was a IOException ZipUtility#PARTIAL_EXTRACTION zip file was partially extracted successfully
-
zip
public static byte[] zip(byte[] unzipped) zip the unzipped byte[]- Parameters:
unzipped- the uncompressed byte[]- Returns:
- the compressed byte[]
-
unzip
public static byte[] unzip(byte[] zipped) unzip the zipped byte[]- Parameters:
zipped- the uncompressed byte[]- Returns:
- the uncompressed byte[]
-