All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.featherfly.common.compress.zip.ZipCompressProvider Maven / Gradle / Ivy

The newest version!

package cn.featherfly.common.compress.zip;

import java.io.File;

import cn.featherfly.common.compress.CompressException;
import cn.featherfly.common.compress.CompressProvider;
import cn.featherfly.common.io.FileUtils;

/**
 * 

* Zip压缩实现 *

* * @author 钟冀 */ public class ZipCompressProvider implements CompressProvider{ private static final String EXT_NAME = "zip"; /** * {@inheritDoc} */ @Override public boolean matchExtName(File compressFile) { return EXT_NAME.equalsIgnoreCase(FileUtils.getFileExtName(compressFile)); } /** * {@inheritDoc} */ @Override public boolean matchContent(File compressFile) { try { new ZipFile(compressFile); return true; } catch (CompressException e) { return false; } } /** * {@inheritDoc} */ @Override public void decompress(File compressFile, File decompressDir) { new ZipFile(compressFile).decompress(decompressDir); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy