Package: org.grails.encoder

## [Java] Class AbstractCharReplacementEncoder

- org.grails.encoder.AbstractCharReplacementEncoder

- All Implemented Interfaces and Traits:
    Encoder, EncodesToWriter, StreamingEncoder

      public abstract class AbstractCharReplacementEncoder
      extends java.lang.Object

  Abstract base class for implementing encoders that do character replacements Implements the StreamingEncoder interface that enables efficient streaming encoding

  Authors:
    Lari Hotari
  Since:
    2.3

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected CodecIdentifier` | `codecIdentifier` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `AbstractCharReplacementEncoder (CodecIdentifier codecIdentifier)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected java.lang.String` | `convertToString(java.lang.Object o)`
    `` | `EncodesToWriter` | `createChainingEncodesToWriter(java.util.List<StreamingEncoder> encoders, boolean applyAdditionalFirst)`
    `` | `protected java.lang.Object` | `doCharReplacementEncoding(java.lang.Object o)`
    `` | `java.lang.Object` | `encode(java.lang.Object o)`
    `` | `void` | `encodeToStream(Encoder thisInstance, java.lang.CharSequence str, int off, int len, EncodedAppender appender, EncodingState encodingState)`
    `` | `void` | `encodeToWriter(java.lang.CharSequence str, int off, int len, java.io.Writer writer, EncodingState encodingState)`
    `` | `void` | `encodeToWriter(char[] buf, int off, int len, java.io.Writer writer, EncodingState encodingState)`
    `` | `protected java.lang.Object` | `escapeCharSequence(java.lang.CharSequence str)`
    `` | `protected java.lang.String` | `escapeCharacter(char ch, char previousChar)` Escape the character, return null if no replacement has to be made
    `` | `CodecIdentifier` | `getCodecIdentifier()`
    `` | `boolean` | `isApplyToSafelyEncoded()`
    `` | `boolean` | `isSafe()`
    `` | `void` | `markEncoded(java.lang.CharSequence string)`

  - ### Inherited Methods Summary

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

    - #### protected CodecIdentifier codecIdentifier

  - ### Constructor Detail

    - #### public AbstractCharReplacementEncoder(CodecIdentifier codecIdentifier)

  - ### Method Detail

    - #### protected java.lang.String convertToString(java.lang.Object o)

    - #### @java.lang.Override public EncodesToWriter createChainingEncodesToWriter(java.util.List<StreamingEncoder> encoders, boolean applyAdditionalFirst)

    - #### protected final java.lang.Object doCharReplacementEncoding(java.lang.Object o)

    - #### public java.lang.Object encode(java.lang.Object o)

    - #### public void encodeToStream(Encoder thisInstance, java.lang.CharSequence str, int off, int len, EncodedAppender appender, EncodingState encodingState)

    - #### @java.lang.Override public void encodeToWriter(java.lang.CharSequence str, int off, int len, java.io.Writer writer, EncodingState encodingState)

    - #### @java.lang.Override public void encodeToWriter(char[] buf, int off, int len, java.io.Writer writer, EncodingState encodingState)

    - #### protected java.lang.Object escapeCharSequence(java.lang.CharSequence str)

    - #### protected java.lang.String escapeCharacter(char ch, char previousChar)

      Escape the character, return null if no replacement has to be made

      Parameters:
        `ch` - the character to escape
        `previousChar` - the previous char
      Returns:
        the replacement string, null if no replacement has to be made

    - #### public CodecIdentifier getCodecIdentifier()

    - #### public boolean isApplyToSafelyEncoded()

    - #### public boolean isSafe()

    - #### public void markEncoded(java.lang.CharSequence string)