Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jp.gr.java_conf.a0.file
Class FileIterator  view FileIterator download FileIterator.java

java.lang.Object
  extended byjp.gr.java_conf.a0.file.FileIterator

public class FileIterator
extends java.lang.Object

This class that is a utility class to iterate files works with FilenameFilter. Iterate files which matches FilenameFilter under the specified directory. this class has recursive flag to iterate files recursively or not.


Field Summary
private  java.util.Vector files
           
private  java.io.FilenameFilter filter
          filename fileter
private  int index
           
private  boolean recursive
          recursive flag.
private  java.io.File rootdir
          target directory
 
Constructor Summary
FileIterator(java.io.File aDir, boolean aRecursive)
          constructor.
FileIterator(java.io.File aDir, boolean aRecursive, java.io.FilenameFilter aFilter)
          constructor.
 
Method Summary
 boolean hasMoreFiles()
          If this object has more files to iterate, then return true.
private  void lookupFiles()
           
 java.io.File nextFile()
          return next file and pointer is incremented.
 void reset()
          resete the iteration pointer to the head.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootdir

private java.io.File rootdir
target directory


recursive

private boolean recursive
recursive flag.


filter

private java.io.FilenameFilter filter
filename fileter


files

private final java.util.Vector files

index

private int index
Constructor Detail

FileIterator

public FileIterator(java.io.File aDir,
                    boolean aRecursive,
                    java.io.FilenameFilter aFilter)
constructor. specify target directory, recursive flag and filename filter.


FileIterator

public FileIterator(java.io.File aDir,
                    boolean aRecursive)
constructor. to iterato all files under the specified directory.

Method Detail

lookupFiles

private void lookupFiles()

hasMoreFiles

public boolean hasMoreFiles()
If this object has more files to iterate, then return true.


nextFile

public java.io.File nextFile()
return next file and pointer is incremented. If call this method with no more elements, then Exception is thrown.


reset

public void reset()
resete the iteration pointer to the head.