org.ajax4jsf.resource
Class CountingOutputWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.ajax4jsf.resource.CountingOutputWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class CountingOutputWriter
extends java.io.Writer

Class provides custom writer implementation with counting of bytes written Is using for replacement of css component writer

Author:
Andrey Markavtsov

Field Summary
static int sizeOfChar
          Size of char type
static int sizeOfInt
          Size of int type
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
CountingOutputWriter()
          Default constructor
 
Method Summary
 void close()
           
 void flush()
           
 java.lang.StringBuffer getContent()
          Methods gets content of written bytes
 int getWritten()
          Methods gets written bytes count
 void write(char[] cbuf)
          Methods appends chars written to buffer
 void write(char[] cbuf, int off, int len)
          Methods appends chars written to buffer
 void write(int c)
          Methods appends int written to buffer
 void write(java.lang.String str)
          Methods appends string written to buffer
 void write(java.lang.String str, int off, int len)
          Methods appends string written to buffer
 
Methods inherited from class java.io.Writer
append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sizeOfChar

public static final int sizeOfChar
Size of char type

See Also:
Constant Field Values

sizeOfInt

public static final int sizeOfInt
Size of int type

See Also:
Constant Field Values
Constructor Detail

CountingOutputWriter

public CountingOutputWriter()
Default constructor

Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Methods appends chars written to buffer

Specified by:
write in class java.io.Writer
Parameters:
cbuf - - chars to be written
off - - offset
len - - length of bytes
Throws:
java.io.IOException

write

public void write(char[] cbuf)
           throws java.io.IOException
Methods appends chars written to buffer

Overrides:
write in class java.io.Writer
Parameters:
cbuf - - chars to be written
Throws:
java.io.IOException

write

public void write(int c)
           throws java.io.IOException
Methods appends int written to buffer

Overrides:
write in class java.io.Writer
Parameters:
c - - int to be written
Throws:
java.io.IOException

write

public void write(java.lang.String str,
                  int off,
                  int len)
           throws java.io.IOException
Methods appends string written to buffer

Overrides:
write in class java.io.Writer
Parameters:
str - - string to be written
off - - offset
len - - length of bytes
Throws:
java.io.IOException

write

public void write(java.lang.String str)
           throws java.io.IOException
Methods appends string written to buffer

Overrides:
write in class java.io.Writer
Parameters:
str - - string to be written
Throws:
java.io.IOException

getWritten

public int getWritten()
Methods gets written bytes count

Returns:
written count of bytes

getContent

public java.lang.StringBuffer getContent()
Methods gets content of written bytes

Returns:
buffer


Copyright © 2009. All Rights Reserved.