net.jxta.util
Class CountingWriter
java.lang.Object
java.io.Writer
java.io.FilterWriter
net.jxta.util.CountingWriter
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public class CountingWriter
- extends FilterWriter
A filter writer which counts the characters sent to the writer. A filter
so that you don't have to count seperately from writing to the output
Method Summary |
long |
getCharsWritten()
Returns the number of chars written to the stream thus far. |
String |
toString()
Debugging toString. |
void |
write(char b)
Merely calls the super version. |
void |
write(char[] b,
int off,
int len)
calls the super version of the same method. |
CountingWriter
public CountingWriter(Writer out)
- Creates a new instance of CountingWriter
toString
public String toString()
-
Debugging toString.
- Overrides:
toString
in class Object
write
public void write(char b)
throws IOException
-
Merely calls the super version.
- Throws:
IOException
write
public void write(char[] b,
int off,
int len)
throws IOException
-
calls the super version of the same method.
- Overrides:
write
in class FilterWriter
- Throws:
IOException
getCharsWritten
public long getCharsWritten()
- Returns the number of chars written to the stream thus far. This and all
the methods in this class are synchronized because bytesWritten cannot be
volatile.
- Returns:
- long containing the number of bytes written.