Package org.grails.web.util
Class BoundedCharsAsEncodedBytesCounter
- java.lang.Object
-
- org.grails.web.util.BoundedCharsAsEncodedBytesCounter
-
public class BoundedCharsAsEncodedBytesCounter extends java.lang.ObjectCounts chars encoded as bytes up to a certain limit (capacity of byte buffer). size() returns the number of bytes, it will return -1 if the capacity was reached or an error occurred. this class is useful for calculating the content length of a HttpServletResponse before the response has been committed
-
-
Constructor Summary
Constructors Constructor Description BoundedCharsAsEncodedBytesCounter()BoundedCharsAsEncodedBytesCounter(int capacity, java.lang.String encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCapacity()java.io.WritergetCountingWriter()java.lang.StringgetEncoding()booleanisWriterReferenced()voidsetCapacity(int capacity)voidsetEncoding(java.lang.String encoding)intsize()voidupdate(char[] buf)voidupdate(char[] buf, int off, int len)voidupdate(java.lang.String str)
-
-
-
Method Detail
-
update
public void update(java.lang.String str)
-
update
public void update(char[] buf)
-
update
public void update(char[] buf, int off, int len)
-
size
public int size()
-
isWriterReferenced
public boolean isWriterReferenced()
-
getCountingWriter
public java.io.Writer getCountingWriter()
-
getEncoding
public java.lang.String getEncoding()
-
setEncoding
public void setEncoding(java.lang.String encoding)
-
getCapacity
public int getCapacity()
-
setCapacity
public void setCapacity(int capacity)
-
-