|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
com.gc.iotools.stream.writer.inspection.StatsWriter
public class StatsWriter
A delegating Writer that gather statistics on the
Writer passed in the constructor.
It can be used to read:
Full statistics are available after the stream has been fully processed (by other parts of the application), or after invoking the method close() while partial statistics are available on the fly.
| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
StatsWriter(Writer destination)
Creates a new StatsWriter with the given destination
character stream. |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
flush()
|
String |
getBitRateString()
Returns a string representation of the writing bit rate formatted with a convenient unit. |
long |
getSize()
Returns the number of characters written until now. |
long |
getTime(TimeUnit tu)
Returns the time spent waiting for the internal stream to write the data. |
void |
write(char[] b)
|
void |
write(char[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StatsWriter(Writer destination)
StatsWriter with the given destination
character stream.
destination - Destination stream where data are written.| Method Detail |
|---|
public void close()
throws IOException
close in interface Closeableclose in class WriterIOException
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic String getBitRateString()
Returns a string representation of the writing bit rate formatted with a convenient unit. The unit will change trying to keep not more than 3 digits.
public long getSize()
public long getTime(TimeUnit tu)
Returns the time spent waiting for the internal stream to write the data.
tu - Unit to measure the time.
public void write(char[] b)
throws IOException
write in class WriterIOException
public void write(char[] b,
int off,
int len)
throws IOException
write in class WriterIOException
public void write(int b)
throws IOException
write in class WriterIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||