Class InputStreamIterator

java.lang.Object
org.atmosphere.util.annotation.InputStreamIterator

public final class InputStreamIterator extends Object
FileIterator enables iteration over all files in a directory and all its sub directories.
Usage:
 FileIterator iter = new FileIterator(new File("./src"));
 File f;
 while ((f = iter.next()) != null) {
     // do something with f
     assert f == iter.getCurrent();
 }
 
Since:
annotation-detector 3.0.0
  • Constructor Details

    • InputStreamIterator

      public InputStreamIterator(InputStream... filesOrDirectories)
      Create a new FileIterator using the specified 'filesOrDirectories' as root.
      If 'filesOrDirectories' contains a file, the iterator just returns that single file. If 'filesOrDirectories' contains a directory, all files in that directory and its sub directories are returned (depth first).
      Parameters:
      filesOrDirectories - Zero or more File objects, which are iterated in the specified order (depth first)
  • Method Details

    • next

      public InputStream next() throws IOException
      Return the next File object or null if no more files are available.
      Throws:
      IOException
    • close

      public void close()
      Close the streams not returned yet, when the caller stops iterating early. The streams already returned are the caller's to close.