tribble.io
Class LineInputStream

java.lang.Object
  extended by tribble.io.LineInputStream
All Implemented Interfaces:
LineInputStreamI

public class LineInputStream
extends java.lang.Object
implements LineInputStreamI

Generic text line input stream interface.

This is a default implementation of the LineInputStreamI interface.

This class is similar to the standard java.io.LineNumberReader class.

Since:
2001-04-23
Version:
$Revision: 1.2 $ $Date: 2003/09/07 16:48:20 $
Author:
David R. Tribble (david@tribble.com).
Copyright ©2001-2003 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.
See Also:
CharInputStreamI, TextLine

Field Summary
protected  java.io.BufferedReader m_in
          Input stream.
protected  int m_lineNo
          Current input line number.
(package private) static java.lang.String REV
          Revision information.
 
Constructor Summary
protected LineInputStream()
          Default constructor.
  LineInputStream(java.io.Reader in)
          Constructor.
 
Method Summary
 void close()
          Closes the input stream.
protected  void finalize()
          Finalization.
 TextLineI readLine()
          Reads the next text line from the input stream.
protected  void setInput(java.io.Reader in)
          Establishes the input stream from which to read text lines.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

m_in

protected java.io.BufferedReader m_in
Input stream.


m_lineNo

protected int m_lineNo
Current input line number.

Constructor Detail

LineInputStream

public LineInputStream(java.io.Reader in)
Constructor. Establishes the input stream from which to read text lines.

Parameters:
in - The input stream from which to read text lines. It is recommended that this be of type java.io.BufferedReader.
Since:
1.1, 2001-04-23

LineInputStream

protected LineInputStream()
Default constructor. Do not use this constructor.

Since:
1.1, 2001-04-23
Method Detail

close

public void close()
Closes the input stream. Also disassociates the underlying input (Reader) stream from this input stream.

Specified by:
close in interface LineInputStreamI
Since:
1.1, 2001-04-23

readLine

public TextLineI readLine()
                   throws java.io.IOException
Reads the next text line from the input stream.

Specified by:
readLine in interface LineInputStreamI
Returns:
The next text line read from the input stream, or -1 if there are no more lines to read (i.e., the end of file was reached).
Throws:
java.io.IOException - Thrown if an I/O (read) error occurs.
Since:
1.1, 2001-04-23

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalization.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
Since:
1.2, 2003-09-06

setInput

protected void setInput(java.io.Reader in)
Establishes the input stream from which to read text lines.

Parameters:
in - The input stream from which to read text lines. It is recommended that this be of type java.io.BufferedReader.
Since:
1.1, 2001-04-23