Groovy Documentation

org.codehaus.groovy.grails.web.util
[Java] Class BoundedCharsAsEncodedBytesCounter

java.lang.Object
  org.codehaus.groovy.grails.web.util.BoundedCharsAsEncodedBytesCounter

public class BoundedCharsAsEncodedBytesCounter
extends java.lang.Object

Counts 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

Authors:
Lari Hotari, Sagire Software Oy


Constructor Summary
BoundedCharsAsEncodedBytesCounter()

BoundedCharsAsEncodedBytesCounter(int capacity, java.lang.String encoding)

 
Method Summary
int getCapacity()

java.io.Writer getCountingWriter()

java.lang.String getEncoding()

boolean isWriterReferenced()

void setCapacity(int capacity)

void setEncoding(java.lang.String encoding)

int size()

void update(java.lang.String str)

void update(char[] buf)

void update(char[] buf, int off, int len)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

BoundedCharsAsEncodedBytesCounter

public BoundedCharsAsEncodedBytesCounter()


BoundedCharsAsEncodedBytesCounter

public BoundedCharsAsEncodedBytesCounter(int capacity, java.lang.String encoding)


 
Method Detail

getCapacity

public int getCapacity()


getCountingWriter

public java.io.Writer getCountingWriter()


getEncoding

public java.lang.String getEncoding()


isWriterReferenced

public boolean isWriterReferenced()


setCapacity

public void setCapacity(int capacity)


setEncoding

public void setEncoding(java.lang.String encoding)


size

public int size()


update

public void update(java.lang.String str)


update

public void update(char[] buf)


update

public void update(char[] buf, int off, int len)


 

Groovy Documentation