Пример #1
0
 public <T extends File> T getFirstChild(Class<T> clazz) {
   FileIterator<T> iter = getFiles(clazz);
   if (iter != null && iter.hasNext()) {
     return iter.next();
   }
   return null;
 }
Пример #2
0
 public <T extends File> T getFile(String name, Class<T> clazz) {
   FileIterator<T> iter = getFiles(clazz);
   if (iter != null) {
     while (iter.hasNext()) {
       T next = iter.next();
       if (next.getName().equals(name)) {
         return next;
       }
     }
     // return iter.next();
   }
   return null;
 }
Пример #3
0
  public File getFile(final String fname) {
    FileIterator<File> iterator =
        getFiles(
            new FileFilter() {

              public boolean accept(File pathname) {
                boolean res = fname.equals(pathname.getName());
                return res;
              }
            });
    if (iterator.hasNext()) {
      return iterator.next();
    }
    return null;
  }