Package: org.grails.encoder

## [Java] Class AbstractEncodedAppender

- org.grails.encoder.AbstractEncodedAppender

- All Implemented Interfaces and Traits:
    EncodedAppender

      public abstract class AbstractEncodedAppender
      extends java.lang.Object
      implements EncodedAppender

  Abstract base class for implementations of EncodedAppender interface

  Authors:
    Lari Hotari
  Since:
    2.3

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private boolean` | `ignoreEncodingState` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)`
    `` | `public void` | `append(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)`
    `` | `public void` | `append(Encoder encoder, StreamEncodeable streamEncodeable)`
    `` | `protected abstract void` | `appendCharSequence(EncodingState encodingState, java.lang.CharSequence str, int start, int end)` Append a portion of a CharSequence to the buffer and attach the encodingState information to it
    `` | `public void` | `appendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)`
    `` | `public void` | `appendEncoded(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)`
    `` | `protected EncodingState` | `createNewEncodingState(Encoder encoder, EncodingState encodingState)`
    `` | `protected void` | `encodeAndWrite(Encoder encoder, EncodingState newEncodingState, java.lang.CharSequence input)` Encode and write input to buffer using a non-streaming encoder
    `` | `public void` | `flush()`
    `` | `public boolean` | `isIgnoreEncodingState()`
    `` | `public void` | `setIgnoreEncodingState(boolean ignoreEncodingState)`
    `` | `public boolean` | `shouldEncode(Encoder encoderToApply, EncodingState encodingState)` Check if the encoder should be used to a input with certain encodingState
    `` | `protected boolean` | `shouldEncodeWith(Encoder encoderToApply, EncodingState encodingState)`
    `` | `protected abstract void` | `write(EncodingState encodingState, char[] b, int off, int len)` Append a portion of a char array to the buffer and attach the encodingState information to it
    `` | `protected abstract void` | `write(EncodingState encodingState, java.lang.String str, int off, int len)` Append a portion of a string to the buffer and attach the encodingState information to it

  - ### 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 boolean ignoreEncodingState

  - ### Method Detail

    - #### public void append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)

    - #### public void append(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)

    - #### public void append(Encoder encoder, StreamEncodeable streamEncodeable)

    - #### protected abstract void appendCharSequence(EncodingState encodingState, java.lang.CharSequence str, int start, int end)

      Append a portion of a CharSequence to the buffer and attach the encodingState information to it

      throws:
        IOException Signals that an I/O exception has occurred.
      Parameters:
        `encodingState` - the new encoding state of the CharSequence portion
        `str` - a CharSequence
        `start` - the start index, inclusive
        `end` - the end index, exclusive

    - #### public void appendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)

    - #### public void appendEncoded(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)

    - #### protected EncodingState createNewEncodingState(Encoder encoder, EncodingState encodingState)

    - #### protected void encodeAndWrite(Encoder encoder, EncodingState newEncodingState, java.lang.CharSequence input)

      Encode and write input to buffer using a non-streaming encoder

      throws:
        IOException Signals that an I/O exception has occurred.
      Parameters:
        `encoder` - the encoder to use
        `newEncodingState` - the new encoding state after encoder has been applied
        `input` - the input CharSequence

    - #### public void flush()

    - #### public boolean isIgnoreEncodingState()

    - #### public void setIgnoreEncodingState(boolean ignoreEncodingState)

    - #### public boolean shouldEncode(Encoder encoderToApply, EncodingState encodingState)

      Check if the encoder should be used to a input with certain encodingState

      Parameters:
        `encoderToApply` - the encoder to apply
        `encodingState` - the current encoding state
      Returns:
        true, if should encode

    - #### protected boolean shouldEncodeWith(Encoder encoderToApply, EncodingState encodingState)

    - #### protected abstract void write(EncodingState encodingState, char[] b, int off, int len)

      Append a portion of a char array to the buffer and attach the encodingState information to it

      throws:
        IOException Signals that an I/O exception has occurred.
      Parameters:
        `encodingState` - the new encoding state of the char array
        `b` - a char array
        `off` - Offset from which to start encoding characters
        `len` - Number of characters to encode

    - #### protected abstract void write(EncodingState encodingState, java.lang.String str, int off, int len)

      Append a portion of a string to the buffer and attach the encodingState information to it

      throws:
        IOException Signals that an I/O exception has occurred.
      Parameters:
        `encodingState` - the new encoding state of the string
        `str` - A String
        `off` - Offset from which to start encoding characters
        `len` - Number of characters to encode