Package totalcross.sys
Class CharacterConverter
- java.lang.Object
-
- java.nio.charset.Charset
-
- totalcross.sys.AbstractCharacterConverter
-
- totalcross.sys.CharacterConverter
-
- All Implemented Interfaces:
java.lang.Comparable<java.nio.charset.Charset>
- Direct Known Subclasses:
CompressedByteArrayStream.DirectCharConverter
public class CharacterConverter extends AbstractCharacterConverter
This class is used to correctly handle international character convertions. The default character scheme converter is the 8859-1. If you want to use a different one, you must extend this class, implementing the bytes2chars and chars2bytes methods, and then assign the public member of totalcross.sys.Convert.charConverter to use your class instead of this default one. You can also use the method Convert.setDefaultConverter to change it, passing, as parameter, the prefix of your CharacterConverter class. For example, if you created a class named Iso88592CharacterConverter, callConvert.setDefaultConverter("Iso88592");To find out which
sun.io.CharacterEncoderyou're using, do:System.out.println(""+sun.io.ByteToCharConverter.getDefault());
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCharacterConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]bytes2chars(byte[] bytes, int offset, int length)Converts the given byte array range to a char array.byte[]chars2bytes(char[] chars, int offset, int length)Converts the given char array range to a byte array.-
Methods inherited from class totalcross.sys.AbstractCharacterConverter
contains, newDecoder, newEncoder
-
-
-
-
Method Detail
-
bytes2chars
public char[] bytes2chars(byte[] bytes, int offset, int length)Converts the given byte array range to a char array.- Specified by:
bytes2charsin classAbstractCharacterConverter
-
chars2bytes
public byte[] chars2bytes(char[] chars, int offset, int length)Converts the given char array range to a byte array.- Specified by:
chars2bytesin classAbstractCharacterConverter
-
-