FreeHEP API
Version current

org.freehep.util.io
Class LineNumberWriter

java.lang.Object
  extended byjava.io.Writer
      extended byorg.freehep.util.io.LineNumberWriter

public class LineNumberWriter
extends Writer

Counts line numbers, based on the first cr-lf, cr or lf it finds. Informs a listener when the linenumber exceeds a threshold. Listeners can only be informed from the second line only.

Version:
$Id: LineNumberWriter.java,v 1.1 2003/05/18 06:43:21 duns Exp $
Author:
Mark Donszelmann
Source Code:
LineNumberWriter.java

Nested Class Summary
static class LineNumberWriter.LineNumberEvent
           
static interface LineNumberWriter.LineNumberListener
           
 
Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LineNumberWriter(Writer out)
           
 
Method Summary
 void addLineNumberListener(LineNumberWriter.LineNumberListener listener, int lineNoLimit)
           
 void close()
           
 void flush()
           
 int getLineNumber()
          Returns the line number that is currently being written.
 void setLineNumber(int lineNo)
           
 void write(char[] cbuf)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(String str)
           
 void write(String str, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineNumberWriter

public LineNumberWriter(Writer out)
Method Detail

write

public void write(char[] cbuf)
           throws IOException
Throws:
IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

write

public void write(String str)
           throws IOException
Throws:
IOException

write

public void write(String str,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

write

public void write(int c)
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

flush

public void flush()
           throws IOException
Throws:
IOException

getLineNumber

public int getLineNumber()
Returns the line number that is currently being written.


setLineNumber

public void setLineNumber(int lineNo)

addLineNumberListener

public void addLineNumberListener(LineNumberWriter.LineNumberListener listener,
                                  int lineNoLimit)
                           throws TooManyListenersException
Throws:
TooManyListenersException

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.