Package nxt.util
Class CountingOutputWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- nxt.util.CountingOutputWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class CountingOutputWriter extends java.io.FilterWriter
CountingOutputWriter extends Writer to count the number of characters written
-
-
Constructor Summary
Constructors Constructor Description CountingOutputWriter(java.io.Writer writer)
Create the CountingOutputWriter for the specified writer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCount()
Return the number of characters writtenvoid
write(char[] cbuf, int off, int len)
Write an array of characters starting at the specified offsetvoid
write(int c)
Write a single charactervoid
write(java.lang.String s, int off, int len)
Write a substring
-
-
-
Method Detail
-
write
public void write(int c) throws java.io.IOException
Write a single character- Overrides:
write
in classjava.io.FilterWriter
- Parameters:
c
- Character to be written- Throws:
java.io.IOException
- I/O error occurred
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException
Write an array of characters starting at the specified offset- Overrides:
write
in classjava.io.FilterWriter
- Parameters:
cbuf
- Characters to be writtenoff
- Starting offsetlen
- Number of characters to write- Throws:
java.io.IOException
- I/O error occurred
-
write
public void write(java.lang.String s, int off, int len) throws java.io.IOException
Write a substring- Overrides:
write
in classjava.io.FilterWriter
- Parameters:
s
- String to be writtenoff
- Starting offsetlen
- Number of characters to write- Throws:
java.io.IOException
- I/O error occurred
-
getCount
public long getCount()
Return the number of characters written- Returns:
- Character count
-
-