waba.sys
Class UTF8CharacterConverter

java.lang.Object
  |
  +--waba.sys.CharacterConverter
        |
        +--waba.sys.UTF8CharacterConverter

public class UTF8CharacterConverter
extends CharacterConverter

This class is used to correctly handle UTF8 byte to UCS-2 chracter conversions.

To use this class, you can call

waba.sys.Convert.setDefaultConverter("UTF8");

See Also:
CharacterConverter

Constructor Summary
UTF8CharacterConverter()
           
 
Method Summary
 char[] bytes2chars(byte[] bytes, int start, int length)
          Convert UTF-8 bytes to UCS-2 characters
 byte[] chars2bytes(char[] chars, int start, int length)
          Convert UCS-2 characters to UTF-8 bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UTF8CharacterConverter

public UTF8CharacterConverter()
Method Detail

bytes2chars

public char[] bytes2chars(byte[] bytes,
                          int start,
                          int length)
Convert UTF-8 bytes to UCS-2 characters
Overrides:
bytes2chars in class CharacterConverter
Parameters:
bytes - byte array to convert
start - first byte to convert in the byte array
length - number of bytes to convert
Returns:
UCS-2 character array resulting from the conversion

chars2bytes

public byte[] chars2bytes(char[] chars,
                          int start,
                          int length)
Convert UCS-2 characters to UTF-8 bytes
Overrides:
chars2bytes in class CharacterConverter
Parameters:
chars - character array to convert
start - first character to convert in the character array
length - number of characters to convert
Returns:
UTF-8 byte array resulting from the conversion