ariba.util.io
Class StatsOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by ariba.util.io.StatsOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class StatsOutputStream
extends java.io.OutputStream

StatsOutputStream is an OutputStream that keeps track of the number of bytes that have been written.

See Also:
OutputStream

Field Summary
 long count
          Number of bytes written.
 
Constructor Summary
StatsOutputStream(java.io.OutputStream base)
          Creates a StatsOutputStream.
 
Method Summary
 void close()
          Closes the stream.
 void flush()
          Flushes the stream.
 void write(byte[] b)
          Writes an array of bytes.
 void write(byte[] b, int off, int len)
          Writes a sub array of bytes.
 void write(int b)
          Writes a byte.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

public long count
Number of bytes written.

Constructor Detail

StatsOutputStream

public StatsOutputStream(java.io.OutputStream base)
Creates a StatsOutputStream.

Parameters:
base - the OutputStream
Method Detail

write

public void write(int b)
           throws java.io.IOException
Writes a byte. This method will block until the byte is actually written.

Specified by:
write in class java.io.OutputStream
Parameters:
b - the byte
Throws:
java.io.IOException - If an I/O error has occurred.

write

public void write(byte[] b)
           throws java.io.IOException
Writes an array of bytes. This method will block until the bytes are actually written.

Overrides:
write in class java.io.OutputStream
Parameters:
b - the data to be written
Throws:
java.io.IOException - If an I/O error has occurred.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes a sub array of bytes.

Overrides:
write in class java.io.OutputStream
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws:
java.io.IOException - If an I/O error has occurred.

flush

public void flush()
           throws java.io.IOException
Flushes the stream. This will write any buffered output bytes.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - If an I/O error has occurred.

close

public void close()
           throws java.io.IOException
Closes the stream. This method must be called to release any resources associated with the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - If an I/O error has occurred.


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.