Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.util
Class LineIterator

java.lang.Object
  extended by oracle.javatools.util.LineIterator
All Implemented Interfaces:
java.util.Iterator

public class LineIterator
extends java.lang.Object
implements java.util.Iterator

An iterator on the lines of an input stream or reader. The iteration yields the lines of the file in order. The repeat() method causes the last line iterated to be repeated once.


Constructor Summary
LineIterator(java.io.BufferedReader reader)
          Creates an iterator for the lines returned by a BufferedReader.
LineIterator(java.io.InputStream stream)
          Creates an iterator for the lines returned by an InputStream.
LineIterator(java.io.Reader reader)
          Creates an iterator for the lines returned by a Reader.
 
Method Summary
 int getLineCount()
          Gets the number of the lines iterated so far.
 boolean hasNext()
          Gets whether the iterator has iterated all lines available from the reader.
 java.lang.Object next()
          Gets the next uniterated line available from the reader, or the last iterated line if repeat() was invoked.
 void remove()
           
 void repeat()
          Repeatd the last iterated line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineIterator

public LineIterator(java.io.BufferedReader reader)
Creates an iterator for the lines returned by a BufferedReader.


LineIterator

public LineIterator(java.io.Reader reader)
Creates an iterator for the lines returned by a Reader. The reader is wrapped in a BufferedReader if it is not already one.


LineIterator

public LineIterator(java.io.InputStream stream)
Creates an iterator for the lines returned by an InputStream. The input stream is wrapped in a BufferedReader.

Method Detail

hasNext

public boolean hasNext()
Gets whether the iterator has iterated all lines available from the reader.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Gets the next uniterated line available from the reader, or the last iterated line if repeat() was invoked.

Specified by:
next in interface java.util.Iterator

repeat

public void repeat()
Repeatd the last iterated line.

Throws:
java.util.NoSuchElementException - if no line has been iterated.

getLineCount

public int getLineCount()
Gets the number of the lines iterated so far. Before the first call to next(), gets 0; after the first call to next(), gets 1, and so on. Repeated lines are not multiply counted.


remove

public void remove()
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.