org.bitstorm.util
Class LineEnumerator
java.lang.Object
org.bitstorm.util.LineEnumerator
- All Implemented Interfaces:
- java.util.Enumeration
- public class LineEnumerator
- extends java.lang.Object
- implements java.util.Enumeration
Enumerates over a string containing a text file, returning lines.
Line endings in the text can be "\r\n", "\r" or "\n".
- Author:
- Edwin Martin
Field Summary |
java.lang.String |
CR
|
java.lang.String |
CRLF
|
(package private) int |
eolOffset
|
java.lang.String |
LF
|
(package private) int |
offset
|
private java.lang.String |
s
|
private java.lang.String |
separator
|
Constructor Summary |
LineEnumerator(java.lang.String s)
Constructs a TextEnumerator. |
Method Summary |
boolean |
hasMoreElements()
|
java.lang.Object |
nextElement()
When the "last line" ends with a return, the next empty line will also be returned, as it should.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
s
private final java.lang.String s
separator
private final java.lang.String separator
CR
public final java.lang.String CR
- See Also:
- Constant Field Values
LF
public final java.lang.String LF
- See Also:
- Constant Field Values
CRLF
public final java.lang.String CRLF
- See Also:
- Constant Field Values
offset
int offset
eolOffset
int eolOffset
LineEnumerator
public LineEnumerator(java.lang.String s)
- Constructs a TextEnumerator.
- Parameters:
s
- String with text
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements
in interface java.util.Enumeration
- See Also:
Enumeration.hasMoreElements()
nextElement
public java.lang.Object nextElement()
- When the "last line" ends with a return, the next empty line will also be returned, as it should.
Returned lines do not end with return chars (LF, CR or CRLF).
- Specified by:
nextElement
in interface java.util.Enumeration
- See Also:
Enumeration.nextElement()
This API descibes the Game of Life program, written by Edwin Martin. The source code is available online too.
Copyright 1996-2004 Edwin Martin <edwin@bitstorm.org>.