Package org.grails.encoder
Interface EncodedAppender
-
- All Known Implementing Classes:
AbstractEncodedAppender,StreamingEncoderEncodedAppender,WriterEncodedAppender
public interface EncodedAppenderThis is the input interface to the streaming encoding solution. Methods in this interface encode the given input and append it to the internal buffer- Since:
- 2.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappend(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)Encodes a portion of a char array and appends it to the buffer.voidappend(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)Encodes a portion of a string and appends it to the buffer.voidappend(Encoder encoder, StreamEncodeable streamEncodeable)Encodes aStreamEncodeableinstance and appends it to the buffer.voidappendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len)Appends an encoded portion of a char array to the buffer.voidappendEncoded(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len)Appends an encoded portion of a string to the buffervoidclose()voidflush()Flush the internal buffer and write the buffered input to a possible destination.booleanisIgnoreEncodingState()voidsetIgnoreEncodingState(boolean ignoreEncodingState)When enabled, will encode all input regardless of it's current state disables double-encoding prevention.booleanshouldEncode(Encoder encoderToApply, EncodingState encodingState)Check if the encoder should be used to a input with certain encodingState
-
-
-
Method Detail
-
append
void append(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len) throws java.io.IOException
Encodes a portion of a string and appends it to the buffer.- Parameters:
encoder- the encoder to useencodingState- the current encoding state of the stringstr- A Stringoff- Offset from which to start encoding characterslen- Number of characters to encode- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
appendEncoded
void appendEncoded(Encoder encoder, EncodingState encodingState, java.lang.CharSequence str, int off, int len) throws java.io.IOException
Appends an encoded portion of a string to the buffer- Parameters:
encoder- the encoder that has been appliedencodingState- the previous encoding state of the stringstr- A Stringoff- Offset from which to start encoding characterslen- Number of characters to encode- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
append
void append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len) throws java.io.IOException
Encodes a portion of a char array and appends it to the buffer.- Parameters:
encoder- the encoder to useencodingState- the current encoding state of the stringb- a char arrayoff- Offset from which to start encoding characterslen- Number of characters to encode- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
appendEncoded
void appendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len) throws java.io.IOException
Appends an encoded portion of a char array to the buffer.- Parameters:
encoder- the encoder that has been appliedencodingState- the previous encoding state of the char arrayb- a char arrayoff- Offset from which to start encoding characterslen- Number of characters to encode- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
append
void append(Encoder encoder, StreamEncodeable streamEncodeable) throws java.io.IOException
Encodes aStreamEncodeableinstance and appends it to the buffer.- Parameters:
encoder- the encoder to usestreamEncodeable- the instance to encode- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
flush
void flush() throws java.io.IOExceptionFlush the internal buffer and write the buffered input to a possible destination.- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
close
void close() throws java.io.IOException- Throws:
java.io.IOException
-
setIgnoreEncodingState
void setIgnoreEncodingState(boolean ignoreEncodingState)
When enabled, will encode all input regardless of it's current state disables double-encoding prevention.- Parameters:
ignoreEncodingState-
-
isIgnoreEncodingState
boolean isIgnoreEncodingState()
- Returns:
- current state of ignoreEncodingState setting
-
shouldEncode
boolean shouldEncode(Encoder encoderToApply, EncodingState encodingState)
Check if the encoder should be used to a input with certain encodingState- Parameters:
encoderToApply- the encoder to applyencodingState- the current encoding state- Returns:
- true, if should encode
-
-