Class TableCharEncoder

java.lang.Object
org.exoplatform.commons.utils.TableCharEncoder
All Implemented Interfaces:
CharEncoder

public class TableCharEncoder extends Object implements CharEncoder
A char encoder that use a table to cache the result produced by a delegate char encoder. This encoder is stateless and should only be composed with stateless char encoder otherwise an unexpected result may happen.
  • Constructor Details

    • TableCharEncoder

      public TableCharEncoder(CharEncoder charEncoder)
      Creates a new table based char encoder.
      Parameters:
      charEncoder - the delegate char encoder
  • Method Details

    • getCharset

      public Charset getCharset()
      Description copied from interface: CharEncoder
      Returns the charset that will perform the encoding.
      Specified by:
      getCharset in interface CharEncoder
      Returns:
      the charset for encoding
    • encode

      public byte[] encode(char c)
      Description copied from interface: CharEncoder
      Encodes a single char into an array of bytes. The returned array of bytes should not be modified.
      Specified by:
      encode in interface CharEncoder
      Parameters:
      c - the char to encode
      Returns:
      the serie of bytes corresponding to the encoded char