The TextIterable's LineIterator was originally an inner private supporting class which is NOT meant to be used as a standalone class but rather just an internal implementation, whereas the commons-io's LineIterator is. There is a difference in intent.
Hanson Char On 10/26/07, Hanson Char <[EMAIL PROTECTED]> wrote: > Well one difference at least is that the LineIterator implements the > Iterator interface whereas TextIterable implements the Iterable > interface. > > An Iterable can take advantage of the 1.5 special for-loop syntax, > whereas an Iterator cannot. > > Hanson Char > > On 10/26/07, Niall Pemberton <[EMAIL PROTECTED]> wrote: > > On 10/26/07, Hanson Char <[EMAIL PROTECTED]> wrote: > > > BTW, there already exists a public standalone class LineIterator: > > > > > > > > > http://commons.apache.org/io/apidocs/org/apache/commons/io/LineIterator.html > > > > > > Same name but for different uses/intents :) > > > > I don't get this - same name, same uses/intents from my PoV. > > > > I also don't really see the value of TextIterable on top of > > LineIterator. Seems to me to be lumping two different steps into one > > convenience class ---> 1) Creating a file Reader and 2) iterating over > > a reader. Also we have a convenience static method in FileUtils that > > does do that: http://tinyurl.com/3cesoo - so the following code does > > pretty much the main job of TextIterable: > > > > LineIterator it = FileUtils.lineIterator(file, "UTF-8"); > > try { > > while (it.hasNext()) { > > String line = it.nextLine(); > > /// do something with line > > } > > } finally { > > LineIterator.closeQuietly(iterator); > > } > > > > Niall > > > > > Hanson Char > > > > > > On 10/25/07, Hanson Char <[EMAIL PROTECTED]> wrote: > > > > Henri, > > > > > > > > LineIterator is intended/designed to be a hidden implementation behind > > > > TextIterable. It's like putting the cart in front of the horse. > > > > Things don't make much sense if LineIterator is taken out of context > > > > as a standalone public class - issues of InputStream vs Reader, > > > > encoding, closing of input stream, etc. go away at the higher level of > > > > abstraction, aka TextIterable. > > > > > > > > The 1.5 issue is, unfortunate, a real issue. I haven't programmed in > > > > pre-1.5 Java for 2+ years now. Sorry for the folks who are not so > > > > lucky. > > > > > > > > Hanson Char > > > > > > > > > > > > On 10/25/07, Henri Yandell <[EMAIL PROTECTED]> wrote: > > > > > On 10/25/07, Hanson Char <[EMAIL PROTECTED]> wrote: > > > > > > Would anyone be interested in including the proposed TextIterable in > > > > > > the commons lang or commons io library ? > > > > > > > > > > > > http://hansonchar.blogspot.com/2007/10/textiterable.html > > > > > > > > > > Things that jump out: > > > > > > > > > > * Definitely more IO than Lang. > > > > > * 1.5 specific - Lang has a scratchspace for 1.5, IO currently doesn't > > > > > have any 1.5 plans. > > > > > * Needs to support encodings. > > > > > * I'd prefer to be able to use LineIterator directly, and to have a > > > > > Reader API in addition to the InputStream one. > > > > > * I don't like that LineIterator closes the passed in InputStream. > > > > > > > > > > My suggestion - a JIRA issue for Commons IO for when it starts > > > > > thinking about a 1.5 dependent version. The 1.5 requiring issues need > > > > > to exist to build up a critical momentum. > > > > > > > > > > Hen > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]