Sharkysoft home

lava.io
Class LineEnumeration

java.lang.Object
  |
  +--lava.io.LineEnumeration
All Implemented Interfaces:
java.util.Enumeration

public class LineEnumeration
extends java.lang.Object
implements java.util.Enumeration

Converts a Reader into an Enumeration of lines.

Details: LineEnumeration is a wrapper class for BufferedReader that converts the Reader's lines into a standard Enumeration. Each line is served as one Object in the Enumeration. An instance of this class can be supplied to any method in any other class that expects an Enumeration. The Enumeration continues until the Reader's EOS (end of stream) has been reach. When the EOS is reached, LineEnumeration automatically closes the underlying stream.

Since:
1998.11.05
Version:
1998.11.05
See Also:
lava.util.Enumeration, lava.io.BufferedReader

Constructor Summary
LineEnumeration(java.io.BufferedReader in)
          Specifies the base Reader.
 
Method Summary
 java.io.IOException getError()
          Returns ioe.
 boolean hasMoreElements()
          Synonym for hasMoreLines.
 boolean hasMoreLines()
          Indicates whether this Enumeration has more elements.
 java.lang.Object nextElement()
          Returns the next element.
 java.lang.String nextLine()
          Returns the next line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineEnumeration

public LineEnumeration(java.io.BufferedReader in)
Specifies the base Reader.

Details: This constructor initializes a new instance with in as the base Reader.

Parameters:
in - the base stream
Since:
1998.11.05
Method Detail

hasMoreLines

public boolean hasMoreLines()
Indicates whether this Enumeration has more elements.

Details: hasMoreLines returns true if there is at least one more line to consume from this Enumeration, false otherwise.

Returns:
true iff there are more lines to consume
Since:
1998.11.05

nextLine

public java.lang.String nextLine()
Returns the next line.

Details: nextLine fetches and returns the next line from this Enumeration. If there are no more lines, nextLine returns null.

Returns:
the next line
Since:
1998.11.05

hasMoreElements

public boolean hasMoreElements()
Synonym for hasMoreLines.

Details: hasMoreElements is a synonym for hasMoreLines. This synonym is included to satisfy the Enumeration interface.

Specified by:
hasMoreElements in interface java.util.Enumeration
Returns:
return value of hasMoreLines
Since:
1998.11.05

nextElement

public java.lang.Object nextElement()
Returns the next element.

Details: nextElement is identical in function to nextLine, with the exception that if there is no next line, it throws a NoSuchElementException instead of returning null. The returned Object is guaranteed to be a String.

Specified by:
nextElement in interface java.util.Enumeration
Returns:
the next line
Since:
1998.12.12

getError

public java.io.IOException getError()
Returns ioe.

Details: getError returns ioe.

Returns:
value of ioe
Since:
1998.11.05

Sharkysoft home