SourceJammer 1.2.0.1 May 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan

org.sourcejammer.server.source
Class TextLineWriter

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

public class TextLineWriter
extends java.lang.Object
implements TextLineAdder, java.io.Serializable

This class is used to append lines into a char array, using a specified end of line char array (typically linefeed or carriage return / linefeed. The lines passed into this class should not include the end of line characters. If the end of line characters are included, these characters will be doubled in the final output.

See Also:
Serialized Form

Constructor Summary
TextLineWriter()
          Default constructor.
TextLineWriter(char[] endOfLine)
          Constructs a TextLineWriter with the passed-in end of line characters using the default buffer size.
TextLineWriter(int size)
          Constructs a TextLineWriter with the passed-in starting buffer size and the default end of line characters.

It is important to use an accurate starting buffer size.
TextLineWriter(int size, char[] endOfLine)
          Constructs a TextLineWriter with the passed-in starting buffer size and end of line characters.
 
Method Summary
 char[] toCharArray()
          Writes the contents of this TextLineWriter to a char array.
 void write(TextLineIterator oIterator)
          Writes the entire contents of the TextLineIterator to this TextLineWriter, beginning with the current line in the iterator.
 void writeLine(char[] line)
          Adds a line to this TextLineWriter.
 void writeLine(java.lang.String sLine)
          Adds a line to this TextLineWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextLineWriter

public TextLineWriter()
Default constructor. Creates a TextLineWriter with default buffer size and default end of line characters.

TextLineWriter

public TextLineWriter(int size)
Constructs a TextLineWriter with the passed-in starting buffer size and the default end of line characters.

It is important to use an accurate starting buffer size. The buffer will resize automatically if the output grows larger than the starting size, but the process of resizing the buffer is fairly inefficient.
Parameters:
size - - starting size of the buffer (number of characters expected in the final output.

TextLineWriter

public TextLineWriter(char[] endOfLine)
Constructs a TextLineWriter with the passed-in end of line characters using the default buffer size.
Parameters:
endOfLine - -- a character array containing the end of line characters to use for the output of this TextLineWriter.

TextLineWriter

public TextLineWriter(int size,
                      char[] endOfLine)
Constructs a TextLineWriter with the passed-in starting buffer size and end of line characters.
Parameters:
size - - starting size of the buffer (number of characters expected in the final output.
endOfLine - -- a character array containing the end of line characters to use for the output of this TextLineWriter.
Method Detail

writeLine

public void writeLine(char[] line)
Adds a line to this TextLineWriter. This class will append the end of line characters to the end of the line.
Specified by:
writeLine in interface TextLineAdder
Parameters:
line - -- a line of text as a char array.

writeLine

public void writeLine(java.lang.String sLine)
Adds a line to this TextLineWriter. This class will append the end of line characters to the end of the line.
Specified by:
writeLine in interface TextLineAdder
Parameters:
line - -- a line of text as a String.

write

public void write(TextLineIterator oIterator)
Writes the entire contents of the TextLineIterator to this TextLineWriter, beginning with the current line in the iterator.
Parameters:
oIterator - -- a TextLineIterator.

toCharArray

public char[] toCharArray()
Writes the contents of this TextLineWriter to a char array. The char array includes the end of line characters.

SourceJammer 1.2.0.1 May 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan