org.sourcejammer.server.source
Class TextLineAdderIterator

java.lang.Object
  |
  +--org.sourcejammer.server.source.TextLineIteratorOutput
        |
        +--org.sourcejammer.server.source.TextLineAdderIterator
All Implemented Interfaces:
java.io.Serializable, TextLineAdder, TextLineIterator

public class TextLineAdderIterator
extends TextLineIteratorOutput
implements TextLineAdder, java.io.Serializable

Builds a text file like TextLineAdder and allows iteration through lines like TextLineIterator.

See Also:
Serialized Form

Field Summary
private  int miIndex
           
private  java.util.Vector mvecLines
           
 
Constructor Summary
TextLineAdderIterator()
           
 
Method Summary
 java.lang.String getNextLine()
          Returns the next line, if there are more lines to return.
 boolean hasMoreLines()
          Returns true if this text line iterator has more lines.
 void skipLines(int numLines)
          Skips the requested number of lines.
 char[] toCharArray()
           
 char[] toCharArray(java.lang.String eol)
           
 java.lang.String toString()
          Returns contents of this TextLineAdderIterator (the entire text file) as a String, the default end of line chars (from AppConfig) as the end of line String.
 java.lang.String toString(java.lang.String eol)
          Returns contents of this TextLineAdderIterator (the entire text file) as a String, using the passed in eol as the end of line String.
 java.lang.StringBuffer toStringBuffer(java.lang.String eol)
          Returns contents of this TextLineAdderIterator (the entire text file) as a StringBuffer, using the passed in eol as the end of line String.
 void writeLine(char[] line)
           
 void writeLine(java.lang.String sLine)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

miIndex

private int miIndex

mvecLines

private java.util.Vector mvecLines
Constructor Detail

TextLineAdderIterator

public TextLineAdderIterator()
Method Detail

writeLine

public void writeLine(char[] line)
Specified by:
writeLine in interface TextLineAdder

writeLine

public void writeLine(java.lang.String sLine)
Specified by:
writeLine in interface TextLineAdder

hasMoreLines

public boolean hasMoreLines()
Description copied from interface: TextLineIterator
Returns true if this text line iterator has more lines.

Specified by:
hasMoreLines in interface TextLineIterator
Specified by:
hasMoreLines in class TextLineIteratorOutput

getNextLine

public java.lang.String getNextLine()
                             throws EndOfSourceException
Returns the next line, if there are more lines to return.

Specified by:
getNextLine in interface TextLineIterator
Specified by:
getNextLine in class TextLineIteratorOutput
Throws:
EndOfSourceException - -- if there are no more lines to return.

skipLines

public void skipLines(int numLines)
               throws EndOfSourceException
Skips the requested number of lines.

Specified by:
skipLines in interface TextLineIterator
Specified by:
skipLines in class TextLineIteratorOutput
Throws:
EndOfSourceException - -- if skipping requested number of lines would point index past end of source file.

toStringBuffer

public java.lang.StringBuffer toStringBuffer(java.lang.String eol)
Returns contents of this TextLineAdderIterator (the entire text file) as a StringBuffer, using the passed in eol as the end of line String.

Specified by:
toStringBuffer in class TextLineIteratorOutput

toString

public java.lang.String toString(java.lang.String eol)
Returns contents of this TextLineAdderIterator (the entire text file) as a String, using the passed in eol as the end of line String.

Specified by:
toString in class TextLineIteratorOutput

toString

public java.lang.String toString()
Returns contents of this TextLineAdderIterator (the entire text file) as a String, the default end of line chars (from AppConfig) as the end of line String.

Specified by:
toString in class TextLineIteratorOutput

toCharArray

public char[] toCharArray(java.lang.String eol)
Specified by:
toCharArray in class TextLineIteratorOutput

toCharArray

public char[] toCharArray()
Specified by:
toCharArray in class TextLineIteratorOutput


Copyright 2003 Soucejammer project.