org.apache.lucene.util
Class CountedOutputStream

Object
  extended by OutputStream
      extended by FilterOutputStream
          extended by CountedOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CountedOutputStream
extends FilterOutputStream

Wraps an OutputStream, and counts how many bytes have been written to it.

Author:
Martin Haye

Field Summary
private  long nWritten
          Count of the number of bytes written to the stream so far
 
Fields inherited from class FilterOutputStream
out
 
Constructor Summary
CountedOutputStream(OutputStream out)
          Wrap an output stream
 
Method Summary
 long nWritten()
          Find out how many bytes have been written so far
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class FilterOutputStream
close, flush, write
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nWritten

private long nWritten
Count of the number of bytes written to the stream so far

Constructor Detail

CountedOutputStream

public CountedOutputStream(OutputStream out)
Wrap an output stream

Method Detail

nWritten

public long nWritten()
Find out how many bytes have been written so far


write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException