commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject [io] File content iterator
Date Sun, 01 Jan 2006 17:13:33 GMT
See http://issues.apache.org/bugzilla/show_bug.cgi?id=38083

The design for a line by line iterator over a file could potentially get 
much more interesting.

The basic requirement is an iterator over Strings representing the file 
lines, that does not load the whole file in the background. This implies 
that the user is responsible for closing the iterator (although it could 
be done automatically once the hasNext() returns false).

I was thinking of an class like this:

public class OpenFileLineIterator implements Iterator {
  boolean hasNext();
  String nextLine();
  void close();
}

Is this a reasonable design?
Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message