public class BoundedCharsAsEncodedBytesCounter extends 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
Constructor and description |
---|
BoundedCharsAsEncodedBytesCounter() |
BoundedCharsAsEncodedBytesCounter(int capacity, String encoding) |
Type Params | Return Type | Name and description |
---|---|---|
|
public int |
getCapacity() |
|
public Writer |
getCountingWriter() |
|
public String |
getEncoding() |
|
public boolean |
isWriterReferenced() |
|
public void |
setCapacity(int capacity) |
|
public void |
setEncoding(String encoding) |
|
public int |
size() |
|
public void |
update(String str) |
|
public void |
update(char[] buf) |
|
public void |
update(char[] buf, int off, int len) |