stcaac 发表于 2017-1-7 13:07:14

用apache common io包获得文件扩展名

apache common io包包含了很多非常实用的工具类,比如
连获得文件的扩展名都有了,比如:
import org.apache.commons.io.FilenameUtils;

String extension = FilenameUtils.getExtension(fileName);
if (extension.equals("zip") || extension.equals("bar")) {
ZipInputStream zip = new ZipInputStream(fileInputStream);
repositoryService.createDeployment().addZipInputStream(zip).deploy();
页: [1]
查看完整版本: 用apache common io包获得文件扩展名