Class CompressUtil
java.lang.Object
jp.ecuacion.tool.housekeepfiles.util.CompressUtil
Provides zip and unzip function.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProvidesunzipfunction.voidzipDirectory(String fromDirPath, String toFilePath) default encoding is set to "UTF-8".voidzipDirectory(String fromDirPath, String toFilePath, String encoding) Zip files in specified directory and create zip file.voiddefault encoding is set to "UTF-8".voidZip specified file.voidzipFileList(List<String> fromFileList, String filePath) default encoding is set to "UTF-8".voidzipFileList(List<String> fromFileList, String filePath, String encoding) Executes zip-archive files specified by ArrayList and create zip file.
-
Constructor Details
-
CompressUtil
public CompressUtil()
-
-
Method Details
-
zipDirectory
default encoding is set to "UTF-8".- Throws:
IOException
-
zipDirectory
Zip files in specified directory and create zip file.- Parameters:
fromDirPath- directory to be archived (for example: C:/sample)toFilePath- zipfile fullpath (for example: C:/sample.zip)encoding- "Shift-JIS", "UTF-8", etc...- Throws:
IOException
-
zipFile
default encoding is set to "UTF-8".- Throws:
IOException
-
zipFile
Zip specified file.- Throws:
IOException
-
zipFileList
default encoding is set to "UTF-8".- Throws:
IOException
-
zipFileList
public void zipFileList(List<String> fromFileList, String filePath, String encoding) throws IOException Executes zip-archive files specified by ArrayList and create zip file.- Parameters:
fromFileList- file list to archive (for example: {C:/sample1.txt, C:/sample2.txt})filePath- zipfile fullpath (for example: C:/sample.zip)- Throws:
IOException
-
unzip
Providesunzipfunction.This method uses java.util.zip.ZipEntry considering backward compatibility. Notice that this app mainly uses org.apache.tools.zip.ZipEntry.
- Throws:
IOException
-