Class RawCodec

java.lang.Object
org.grails.encoder.impl.RawCodec
All Implemented Interfaces:
CodecFactory, CodecIdentifierProvider, Decoder, Encoder, StreamingEncoder

public class RawCodec extends Object implements Encoder, Decoder, StreamingEncoder, CodecFactory
Codec that doesn't do any encoding or decoding. This is for marking some text as "safe" in the buffer. "safe" part of the buffer won't be encoded later if a codec is applied to the buffer
Since:
2.3
  • Constructor Details

    • RawCodec

      public RawCodec()
  • Method Details

    • decode

      public Object decode(Object o)
      Description copied from interface: Decoder
      Decode given input object
      Specified by:
      decode in interface Decoder
      Parameters:
      o - the input object
      Returns:
      the decoded object
    • isSafe

      public boolean isSafe()
      Description copied from interface: Encoder
      Checks if this encoder is XSS "safe". This means that after appling this encoder, the characters have been escaped and are XSS safe to be included in HTML documents.
      Specified by:
      isSafe in interface Encoder
      Returns:
      true, if is safe
    • encode

      public Object encode(Object o)
      Description copied from interface: Encoder
      Encode given input object
      Specified by:
      encode in interface Encoder
      Parameters:
      o - the input object
      Returns:
      the encoded object
    • markEncoded

      public void markEncoded(CharSequence string)
      Description copied from interface: Encoder
      Mark this instance as encoded with this encoder in the current EncodingStateRegistry
      Specified by:
      markEncoded in interface Encoder
      Parameters:
      string - a CharSequence to mark as encoded
    • encodeToStream

      public void encodeToStream(Encoder thisInstance, CharSequence source, int offset, int len, EncodedAppender appender, EncodingState encodingState) throws IOException
      Description copied from interface: StreamingEncoder
      Encode and append portion of source CharSequence to the appender.
      Specified by:
      encodeToStream in interface StreamingEncoder
      source - The source CharSequence
      offset - Offset from which to start encoding characters
      len - Number of characters to encode
      appender - the appender to write to
      encodingState - the current encoding state
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getCodecIdentifier

      public CodecIdentifier getCodecIdentifier()
      Description copied from interface: CodecIdentifierProvider
      Gets the codec identifier information.
      Specified by:
      getCodecIdentifier in interface CodecIdentifierProvider
      Returns:
      the codec identifier information
    • isApplyToSafelyEncoded

      public boolean isApplyToSafelyEncoded()
      Specified by:
      isApplyToSafelyEncoded in interface Encoder
      Returns:
      true if this this codec should be applied to a buffer part that is already encoded with a safe encoder
    • getEncoder

      public Encoder getEncoder()
      Description copied from interface: CodecFactory
      Gets the encoder instance.
      Specified by:
      getEncoder in interface CodecFactory
      Returns:
      the encoder
    • getDecoder

      public Decoder getDecoder()
      Description copied from interface: CodecFactory
      Gets the decoder instance.
      Specified by:
      getDecoder in interface CodecFactory
      Returns:
      the decoder