Class CharsetCharEncoder

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

public class CharsetCharEncoder extends Object implements CharEncoder
An implementation of a char encoder that is stateless and is based on a specified charset.
Version:
$Revision$
Author:
Julien Viet
  • Constructor Details

    • CharsetCharEncoder

      public CharsetCharEncoder(Charset charset)
  • Method Details

    • getUTF8

      public static CharEncoder getUTF8()
    • 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