用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();

你可能感兴趣的:(java,apache)