use of java.io.FilenameFilter in project jetty.project by eclipse.
the class HpackPerfTest method runStories.
private void runStories(int maxDynamicTableSize) throws Exception {
// Find files
File data = MavenTestingUtils.getTestResourceDir("data");
String[] files = data.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("story_");
}
});
// Parse JSON
Map<String, Object>[] stories = new Map[files.length];
int i = 0;
for (String story : files) stories[i++] = (Map<String, Object>) JSON.parse(new FileReader(new File(data, story)));
ByteBuffer buffer = BufferUtil.allocate(256 * 1024);
// Encode all the requests
encodeStories(buffer, stories, "request");
// clear table
BufferUtil.clearToFill(buffer);
BufferUtil.flipToFlush(buffer, 0);
// Encode all the responses
encodeStories(buffer, stories, "response");
}
use of java.io.FilenameFilter in project storm by apache.
the class Localizer method readCurrentBlobs.
// Looks for files in the directory with .current suffix
protected File[] readCurrentBlobs(String location) {
File dir = new File(location);
File[] files = null;
if (dir.exists()) {
files = dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(Utils.DEFAULT_CURRENT_BLOB_SUFFIX);
}
});
}
return files;
}
use of java.io.FilenameFilter in project jscs-plugin by idok.
the class JscsFinder method searchForJscsRCFiles.
/**
* find possible jscs rc files
* @param projectRoot
* @return
*/
public static List<String> searchForJscsRCFiles(final File projectRoot) {
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File file, String name) {
return name.equals(JSCSRC);
}
};
// return Arrays.asList(files);
List<String> files = FileUtils.recursiveVisitor(projectRoot, filter);
return ContainerUtil.map(files, new Function<String, String>() {
public String fun(String curFile) {
return FileUtils.makeRelative(projectRoot, new File(curFile));
}
});
}
use of java.io.FilenameFilter in project head by mifos.
the class DatasetVersionTest method checkDataSetDatabaseVersion.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void checkDataSetDatabaseVersion() throws Exception {
class FileExtensionFilter implements FilenameFilter {
String prefix = "*";
String ext = "*";
public FileExtensionFilter(String prefix, String ext) {
this.prefix = prefix;
this.ext = ext;
}
@Override
public boolean accept(@SuppressWarnings("unused") File dir, String name) {
boolean validFile = false;
if (name.startsWith(prefix) && name.endsWith(ext)) {
validFile = true;
}
return validFile;
}
}
// FIXME - Path works for maven build but not from eclipse
// To run this test in eclipse, change path below to: "acceptanceTests/target/test-classes/dataSets"
File f = new File("target/test-classes/dataSets");
FileExtensionFilter filter = new FileExtensionFilter("", "dbunit.xml");
File[] acceptList = f.listFiles(filter);
for (File element : acceptList) {
verifyDatabaseVersion(element.getName());
}
}
use of java.io.FilenameFilter in project jop by jop-devel.
the class ClassPath method getClassPath.
/** Checks for class path components in the following properties:
* "java.class.path", "sun.boot.class.path", "java.ext.dirs"
*
* @return class path as used by default by BCEL
*/
public static final String getClassPath() {
String class_path = System.getProperty("java.class.path");
String boot_path = System.getProperty("sun.boot.class.path");
String ext_path = System.getProperty("java.ext.dirs");
List list = new ArrayList();
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
List dirs = new ArrayList();
getPathComponents(ext_path, dirs);
for (Iterator e = dirs.iterator(); e.hasNext(); ) {
File ext_dir = new File((String) e.next());
String[] extensions = ext_dir.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
name = name.toLowerCase(Locale.ENGLISH);
return name.endsWith(".zip") || name.endsWith(".jar");
}
});
if (extensions != null) {
for (int i = 0; i < extensions.length; i++) {
list.add(ext_dir.getPath() + File.separatorChar + extensions[i]);
}
}
}
StringBuffer buf = new StringBuffer();
for (Iterator e = list.iterator(); e.hasNext(); ) {
buf.append((String) e.next());
if (e.hasNext()) {
buf.append(File.pathSeparatorChar);
}
}
return buf.toString().intern();
}
Aggregations