commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <>
Subject [io] File content iterator
Date Sun, 01 Jan 2006 17:13:33 GMT

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?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message