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

com.jeesuite.mybatis.parser.FileUtils Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
/**
 * 
 */
package com.jeesuite.mybatis.parser;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import org.apache.commons.lang3.StringUtils;

/**
 * @description 
* @author vakin * @date 2016年3月23日 * @Copyright (c) 2015, jwww */ public class FileUtils { public static Collection listFiles(File directory, final String extensions) { File[] files = directory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(extensions); } }); return Arrays.asList(files); } public static List listFiles(JarFile jarFile, String extensions) { if (jarFile == null || StringUtils.isEmpty(extensions)) return null; List files = new ArrayList(); Enumeration entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (name.endsWith(extensions)) { files.add(name); } } return files; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy