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

猜你喜欢

转载自wentao365.iteye.com/blog/1674714