org.exoplatform.commons.utils
Class CharsetCharEncoder

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

public class CharsetCharEncoder
extends java.lang.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 Summary
CharsetCharEncoder(java.nio.charset.Charset charset)
           
 
Method Summary
 byte[] encode(char c)
          Encodes a single char into an array of bytes.
static CharEncoder getUTF8()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharsetCharEncoder

public CharsetCharEncoder(java.nio.charset.Charset charset)
Method Detail

getUTF8

public static CharEncoder getUTF8()

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


Copyright © 2010 eXo Platform SAS. All Rights Reserved.