Package: org.grails.encoder

## [Java] Interface EncodedAppender

-     public interface EncodedAppender

  This is the input interface to the streaming encoding solution. Methods in this interface encode the given input and append it to the internal buffer

  Authors:
    Lari Hotari
  Since:
    2.3

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `append(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)` Encodes a portion of a string and appends it to the buffer.
    `` | `public void` | `append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)` Encodes a portion of a char array and appends it to the buffer.
    `` | `public void` | `append(Encoder encoder, StreamEncodeable streamEncodeable)` Encodes a StreamEncodeable instance and appends it to the buffer.
    `` | `public void` | `appendEncoded(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)` Appends an encoded portion of a string to the buffer
    `` | `public void` | `appendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)` Appends an encoded portion of a char array to the buffer.
    `` | `public void` | `close()`
    `` | `public void` | `flush()` Flush the internal buffer and write the buffered input to a possible destination.
    `` | `public boolean` | `isIgnoreEncodingState()` Returns: current state of ignoreEncodingState setting
    `` | `public void` | `setIgnoreEncodingState(boolean ignoreEncodingState)` When enabled, will encode all input regardless of it's current state disables double-encoding prevention.
    `` | `public boolean` | `shouldEncode(Encoder encoderToApply, EncodingState encodingState)` Check if the encoder should be used to a input with certain encodingState

- - ### Method Detail

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

      Encodes a portion of a string and appends it to the buffer.

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

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

      Encodes a portion of a char array and appends it to the buffer.

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

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

      Encodes a StreamEncodeable instance and appends it to the buffer.

      throws:
        IOException Signals that an I/O exception has occurred.
      Parameters:
        `encoder` - the encoder to use
        `streamEncodeable` - the instance to encode

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

      Appends an encoded portion of a string to the buffer

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

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

      Appends an encoded portion of a char array to the buffer.

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

    - #### public void close()

    - #### public void flush()

      Flush the internal buffer and write the buffered input to a possible destination.

      throws:
        IOException Signals that an I/O exception has occurred.

    - #### public boolean isIgnoreEncodingState()

      Returns:
        current state of ignoreEncodingState setting

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

      When enabled, will encode all input regardless of it's current state disables double-encoding prevention.

      Parameters:
        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