com.sun.faban.driver.transport.util
Class TimedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.sun.faban.driver.transport.util.TimedOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class TimedOutputStream
- extends FilterOutputStream
A pass-through output stream that records the time of the output.
Note that the client-side time recording for writes is
always before the write happens.
- Author:
- Akara Sucharitakul
Method Summary |
void |
write(byte[] b)
Writes b.length bytes to this output stream. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified
byte array starting at offset off to
this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimedOutputStream
public TimedOutputStream(OutputStream out)
- Creates an output stream filter built on top of the specified
underlying output stream.
- Parameters:
out
- the underlying output stream to be assigned to
the field this.out for later use, or
null
if this instance is to be
created without an underlying stream.
write
public void write(int b)
throws IOException
- Writes the specified
byte
to this output stream.
The write
method of FilterOutputStream
calls the write
method of its underlying output stream,
that is, it performs out.write(b).
Implements the abstract write method of OutputStream.
- Overrides:
write
in class FilterOutputStream
- Parameters:
b
- the byte
.
- Throws:
IOException
- IOException
if an I/O error occurs.
write
public void write(byte[] b)
throws IOException
- Writes
b.length
bytes to this output stream.
The write
method of FilterOutputStream
calls its write
method of three arguments with the
arguments b
, 0
, and
b.length
.
Note that this method does not call the one-argument
write
method of its underlying stream with the single
argument b
.
- Overrides:
write
in class FilterOutputStream
- Parameters:
b
- the data to be written.
- Throws:
IOException
- {IOException
if an I/O error occurs.- See Also:
FilterOutputStream.write(byte[], int, int)
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Writes
len
bytes from the specified
byte
array starting at offset off
to
this output stream.
As suggested by the FilterOutputStream superclass, this method
implements as more efficient task by calling the underlying output
stream directly.
- Overrides:
write
in class FilterOutputStream
- Parameters:
b
- The bytes to writeoff
- The offset into the byte arraylen
- The length to write
- Throws:
IOException
- If there is an error writing