BoundedCharsAsEncodedBytesCounter (Grails 6.0.0)

Package: org.grails.web.util

## [Java] Class BoundedCharsAsEncodedBytesCounter

- org.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

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `class` | `BoundedCharsAsEncodedBytesCounter.BoundedCharsAsEncodedBytesCounterWriter` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.nio.ByteBuffer` | `bb` |
    `private boolean` | `calculationActive` |
    `private int` | `capacity` |
    `private java.nio.charset.CharsetEncoder` | `ce` |
    `private java.lang.String` | `encoding` |
    `private BoundedCharsAsEncodedBytesCounter.BoundedCharsAsEncodedBytesCounterWriter` | `writer` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `BoundedCharsAsEncodedBytesCounter ()`
    `BoundedCharsAsEncodedBytesCounter (int capacity, java.lang.String encoding)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public int` | `getCapacity()`
    `` | `public java.io.Writer` | `getCountingWriter()`
    `` | `public java.lang.String` | `getEncoding()`
    `` | `public boolean` | `isWriterReferenced()`
    `` | `public void` | `setCapacity(int capacity)`
    `` | `public void` | `setEncoding(java.lang.String encoding)`
    `` | `public int` | `size()`
    `` | `private void` | `terminateCalculation()`
    `` | `public void` | `update(java.lang.String str)`
    `` | `public void` | `update(char[] buf)`
    `` | `public void` | `update(char[] buf, int off, int len)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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()`

- - ### Field Detail

    - #### private java.nio.ByteBuffer bb

    - #### private boolean calculationActive

    - #### private int capacity

    - #### private java.nio.charset.CharsetEncoder ce

    - #### private java.lang.String encoding

    - #### private BoundedCharsAsEncodedBytesCounter.BoundedCharsAsEncodedBytesCounterWriter writer

  - ### Constructor Detail

    - #### public BoundedCharsAsEncodedBytesCounter()

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

  - ### Method Detail

    - #### public int getCapacity()

    - #### public java.io.Writer getCountingWriter()

    - #### public java.lang.String getEncoding()

    - #### public boolean isWriterReferenced()

    - #### public void setCapacity(int capacity)

    - #### public void setEncoding(java.lang.String encoding)

    - #### public int size()

    - #### private void terminateCalculation()

    - #### public void update(java.lang.String str)

    - #### public void update(char[] buf)

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