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 Summary
All 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
- 
ZipUtil
public ZipUtil()
 
- 
ZipUtil
public ZipUtil(String charset)
 
 - 
 
- 
Method Detail
- 
unzip
public 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.
 
 
- 
getEntryBytes
public byte[] getEntryBytes(File zipsource, String entry)
Read the entry inside the file zip resource.- Parameters:
 zipsource- File to read inside itentry- The entry to be read- Returns:
 - The bytes of the entry
 
 
- 
getEntryStream
public InputStream getEntryStream(File zip, String entry)
Read the entry inside the file zip resource.- Parameters:
 zip- File to read inside itentry- The entry to be read- Returns:
 - The stream of the entry
 
 
- 
getEntryContent
public String getEntryContent(File zip, String entry) throws FileNotFoundException, IOException
- Throws:
 FileNotFoundExceptionIOException
 
- 
addEntry
public static void addEntry(File zip, String entry, InputStream content)
 
- 
zipFile
public void zipFile(File src, File dest)
Compress a single file- Parameters:
 src- The source filedest- The destination archive file
 
- 
zipFolder
public void zipFolder(File inFolder, File outFile)
Zips a folder into a .zip archive- Parameters:
 inFolder- the folder to compressoutFile- the zip file
 
- 
getFileNameCharset
public String getFileNameCharset()
 
- 
setFileNameCharset
public void setFileNameCharset(String fileNameCharset)
 
 - 
 
 -