use of lucee.commons.io.res.filter.ResourceNameFilter in project Lucee by lucee.
the class Directory method _fillArrayName.
// this method only exists for performance reasion
private static int _fillArrayName(Array arr, Resource directory, ResourceFilter filter, int count) {
if (filter == null || filter instanceof ResourceNameFilter) {
ResourceNameFilter rnf = filter == null ? null : (ResourceNameFilter) filter;
String[] list = directory.list();
if (list == null || list.length == 0)
return count;
for (int i = 0; i < list.length; i++) {
if (rnf == null || rnf.accept(directory, list[i])) {
arr.appendEL(list[i]);
}
}
} else {
Resource[] list = directory.listResources();
if (list == null || list.length == 0)
return count;
for (int i = 0; i < list.length; i++) {
if (filter.accept(list[i])) {
arr.appendEL(list[i].getName());
}
}
}
return count;
}
use of lucee.commons.io.res.filter.ResourceNameFilter in project Lucee by lucee.
the class Directory method _fillQueryNames.
// this method only exists for performance reasion
private static int _fillQueryNames(Query query, Resource directory, ResourceFilter filter, int count) throws PageException {
if (filter == null || filter instanceof ResourceNameFilter) {
ResourceNameFilter rnf = filter == null ? null : (ResourceNameFilter) filter;
String[] list = directory.list();
if (list == null || list.length == 0)
return count;
for (int i = 0; i < list.length; i++) {
if (rnf == null || rnf.accept(directory, list[i])) {
query.addRow(1);
count++;
query.setAt(KeyConstants._name, count, list[i]);
}
}
} else {
Resource[] list = directory.listResources();
if (list == null || list.length == 0)
return count;
for (int i = 0; i < list.length; i++) {
if (filter == null || filter.accept(list[i])) {
query.addRow(1);
count++;
query.setAt(KeyConstants._name, count, list[i].getName());
}
}
}
return count;
}
Aggregations