Package org.grails.encoder.impl
Class RawCodec
- java.lang.Object
-
- org.grails.encoder.impl.RawCodec
-
- All Implemented Interfaces:
CodecFactory,CodecIdentifierProvider,Decoder,Encoder,StreamingEncoder
public class RawCodec extends java.lang.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 Summary
Constructors Constructor Description RawCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectdecode(java.lang.Object o)Decode given input objectjava.lang.Objectencode(java.lang.Object o)Encode given input objectvoidencodeToStream(Encoder thisInstance, java.lang.CharSequence source, int offset, int len, EncodedAppender appender, EncodingState encodingState)Encode and append portion of source CharSequence to the appender.CodecIdentifiergetCodecIdentifier()Gets the codec identifier information.DecodergetDecoder()Gets the decoder instance.EncodergetEncoder()Gets the encoder instance.booleanisApplyToSafelyEncoded()booleanisSafe()Checks if this encoder is XSS "safe".voidmarkEncoded(java.lang.CharSequence string)Mark this instance as encoded with this encoder in the currentEncodingStateRegistry
-
-
-
Method Detail
-
decode
public java.lang.Object decode(java.lang.Object o)
Description copied from interface:DecoderDecode given input object
-
isSafe
public boolean isSafe()
Description copied from interface:EncoderChecks 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.
-
encode
public java.lang.Object encode(java.lang.Object o)
Description copied from interface:EncoderEncode given input object
-
markEncoded
public void markEncoded(java.lang.CharSequence string)
Description copied from interface:EncoderMark this instance as encoded with this encoder in the currentEncodingStateRegistry- Specified by:
markEncodedin interfaceEncoder- Parameters:
string- a CharSequence to mark as encoded
-
encodeToStream
public void encodeToStream(Encoder thisInstance, java.lang.CharSequence source, int offset, int len, EncodedAppender appender, EncodingState encodingState) throws java.io.IOException
Description copied from interface:StreamingEncoderEncode and append portion of source CharSequence to the appender.- Specified by:
encodeToStreamin interfaceStreamingEncodersource- The source CharSequenceoffset- Offset from which to start encoding characterslen- Number of characters to encodeappender- the appender to write toencodingState- the current encoding state- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
getCodecIdentifier
public CodecIdentifier getCodecIdentifier()
Description copied from interface:CodecIdentifierProviderGets the codec identifier information.- Specified by:
getCodecIdentifierin interfaceCodecIdentifierProvider- Returns:
- the codec identifier information
-
isApplyToSafelyEncoded
public boolean isApplyToSafelyEncoded()
- Specified by:
isApplyToSafelyEncodedin interfaceEncoder- Returns:
trueif 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:CodecFactoryGets the encoder instance.- Specified by:
getEncoderin interfaceCodecFactory- Returns:
- the encoder
-
getDecoder
public Decoder getDecoder()
Description copied from interface:CodecFactoryGets the decoder instance.- Specified by:
getDecoderin interfaceCodecFactory- Returns:
- the decoder
-
-