Interface EncodedAppender

All Known Implementing Classes:
AbstractEncodedAppender, StreamingEncoderEncodedAppender, WriterEncodedAppender

public interface EncodedAppender
This 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 Details

    • append

      void append(Encoder encoder, EncodingState encodingState, CharSequence str, int off, int len) throws IOException
      Encodes a portion of a string and appends it to the buffer.
      Parameters:
      encoder - the encoder to use
      encodingState - the current encoding state of the string
      str - A String
      off - Offset from which to start encoding characters
      len - Number of characters to encode
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • appendEncoded

      void appendEncoded(Encoder encoder, EncodingState encodingState, CharSequence str, int off, int len) throws IOException
      Appends an encoded portion of a string to the buffer
      Parameters:
      encoder - the encoder that has been applied
      encodingState - the previous encoding state of the string
      str - A String
      off - Offset from which to start encoding characters
      len - Number of characters to encode
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • append

      void append(Encoder encoder, EncodingState encodingState, char[] b, int off, int len) throws IOException
      Encodes a portion of a char array and appends it to the buffer.
      Parameters:
      encoder - the encoder to use
      encodingState - the current encoding state of the string
      b - a char array
      off - Offset from which to start encoding characters
      len - Number of characters to encode
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • appendEncoded

      void appendEncoded(Encoder encoder, EncodingState encodingState, char[] b, int off, int len) throws IOException
      Appends an encoded portion of a char array to the buffer.
      Parameters:
      encoder - the encoder that has been applied
      encodingState - the previous encoding state of the char array
      b - a char array
      off - Offset from which to start encoding characters
      len - Number of characters to encode
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • append

      void append(Encoder encoder, StreamEncodeable streamEncodeable) throws IOException
      Encodes a StreamEncodeable instance and appends it to the buffer.
      Parameters:
      encoder - the encoder to use
      streamEncodeable - the instance to encode
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • flush

      void flush() throws IOException
      Flush the internal buffer and write the buffered input to a possible destination.
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • close

      void close() throws IOException
      Throws:
      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 apply
      encodingState - the current encoding state
      Returns:
      true, if should encode