Package org.grails.encoder.impl
Class RawCodec
java.lang.Object
org.grails.encoder.impl.RawCodec
- All Implemented Interfaces:
CodecFactory,CodecIdentifierProvider,Decoder,Encoder,StreamingEncoder
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 -
Method Summary
Modifier and TypeMethodDescriptionDecode given input objectEncode given input objectvoidencodeToStream(Encoder thisInstance, CharSequence source, int offset, int len, EncodedAppender appender, EncodingState encodingState) Encode and append portion of source CharSequence to the appender.Gets the codec identifier information.Gets the decoder instance.Gets the encoder instance.booleanbooleanisSafe()Checks if this encoder is XSS "safe".voidmarkEncoded(CharSequence string) Mark this instance as encoded with this encoder in the currentEncodingStateRegistry
-
Constructor Details
-
RawCodec
public RawCodec()
-
-
Method Details
-
decode
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
Description copied from interface:EncoderEncode given input object -
markEncoded
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, CharSequence source, int offset, int len, EncodedAppender appender, EncodingState encodingState) throws 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:
IOException- Signals that an I/O exception has occurred.
-
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
Description copied from interface:CodecFactoryGets the encoder instance.- Specified by:
getEncoderin interfaceCodecFactory- Returns:
- the encoder
-
getDecoder
Description copied from interface:CodecFactoryGets the decoder instance.- Specified by:
getDecoderin interfaceCodecFactory- Returns:
- the decoder
-