ariba.util.io
Class StatsOutputStream

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

public class StatsOutputStream
extends 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(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(OutputStream base)
Creates a StatsOutputStream.

Parameters:
base - the OutputStream
Method Detail

write

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

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

write

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

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

write

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

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

flush

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

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

close

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

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


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