gov.llnl.babel.backend.writers
Class LineCountingFilterWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by gov.llnl.babel.backend.writers.LineCountingFilterWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LineCountingFilterWriter
extends java.io.FilterWriter

The LineCountingFilterWriter keeps track of the current line going through the character stream. If the write throws an exception, the line count remains unchanged.


Field Summary
protected  int d_line_count
           
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LineCountingFilterWriter(java.io.Writer out)
           
 
Method Summary
protected  int countLines(char[] x, int off, int len)
           
 int getLineCount()
           
 void setLineCount(int i)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(java.lang.String str, int off, int len)
           
 
Methods inherited from class java.io.FilterWriter
close, flush
 
Methods inherited from class java.io.Writer
append, append, append, append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_line_count

protected int d_line_count
Constructor Detail

LineCountingFilterWriter

public LineCountingFilterWriter(java.io.Writer out)
Method Detail

getLineCount

public int getLineCount()

setLineCount

public void setLineCount(int i)

write

public void write(int c)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException

write

public void write(java.lang.String str,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterWriter
Throws:
java.io.IOException

countLines

protected int countLines(char[] x,
                         int off,
                         int len)