Package com.logicaldoc.util.io
Class ZipUtil
- java.lang.Object
- 
- com.logicaldoc.util.io.ZipUtil
 
- 
 public class ZipUtil extends Object This class is for handling with zip-files.- Version:
- 4.0
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddEntry(File zip, String entry, InputStream content)byte[]getEntryBytes(File zipsource, String entry)Read the entry inside the file zip resource.StringgetEntryContent(File zip, String entry)InputStreamgetEntryStream(File zip, String entry)Read the entry inside the file zip resource.StringgetFileNameCharset()List<String>listEntries(File zipsource)List<ZipEntry>listZipEntries(File zipsource)voidsetFileNameCharset(String fileNameCharset)booleanunzip(String zipsource, String target)This method extracts all entries of a zip-file.voidzipFile(File src, File dest)Compress a single filevoidzipFolder(File inFolder, File outFile)Zips a folder into a .zip archive
 
- 
- 
- 
Constructor Detail- 
ZipUtilpublic ZipUtil() 
 - 
ZipUtilpublic ZipUtil(String charset) 
 
- 
 - 
Method Detail- 
unzippublic boolean unzip(String zipsource, String target) This method extracts all entries of a zip-file.- Parameters:
- zipsource- Path of the zip-file.
- target- Path of the extracted files.
- Returns:
- True if successfully extracted.
 
 - 
getEntryBytespublic byte[] getEntryBytes(File zipsource, String entry) Read the entry inside the file zip resource.- Parameters:
- zipsource- File to read inside it
- entry- The entry to be read
- Returns:
- The bytes of the entry
 
 - 
getEntryStreampublic InputStream getEntryStream(File zip, String entry) Read the entry inside the file zip resource.- Parameters:
- zip- File to read inside it
- entry- The entry to be read
- Returns:
- The stream of the entry
 
 - 
getEntryContentpublic String getEntryContent(File zip, String entry) throws FileNotFoundException, IOException - Throws:
- FileNotFoundException
- IOException
 
 - 
addEntrypublic static void addEntry(File zip, String entry, InputStream content) 
 - 
zipFilepublic void zipFile(File src, File dest) Compress a single file- Parameters:
- src- The source file
- dest- The destination archive file
 
 - 
zipFolderpublic void zipFolder(File inFolder, File outFile) Zips a folder into a .zip archive- Parameters:
- inFolder- the folder to compress
- outFile- the zip file
 
 - 
getFileNameCharsetpublic String getFileNameCharset() 
 - 
setFileNameCharsetpublic void setFileNameCharset(String fileNameCharset) 
 
- 
 
-