commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: [io] File content iterator
Date Thu, 05 Jan 2006 01:47:36 GMT
James Ring wrote:
>>I was thinking of an class like this:
>>
>>public class OpenFileLineIterator implements Iterator {
>>  boolean hasNext();
>>  String nextLine();
>>  void close();
>>}
> 
> Looks fine to me.. Did you intend to use a BufferedReader for the 
> implementation of nextLine()?
> 
> Also, maybe hasNext() will be a bit tricky to determine, because you don't 
> know if you're at the end of a file until you try reading from it. Maybe this 
> isn't a problem...

I would expect hasNext to actually read the next line and store it in 
the iterator for nextLine() to return. That way its fairly easy to 
implement.

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