Class 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
    • Constructor Detail

      • BoundedCharsAsEncodedBytesCounter

        public BoundedCharsAsEncodedBytesCounter()
      • BoundedCharsAsEncodedBytesCounter

        public BoundedCharsAsEncodedBytesCounter​(int capacity,
                                                 java.lang.String encoding)
    • 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)