GLLib: GLLib : text

GLLib

GLLib : text
[GLLib]

text decoding and caching function More...

Modules

 GLLang

Functions

static void Text_BuildStringCache ()
 cache all the text into string Array
static void Text_FreeAll ()
 free all the data-array used by the text
static String Text_FromUTF8 (byte[] src, int offset, int len)
 get a string from an UTF-8 encoded byte array.
String Text_GetLanguageAsString (int languageCode)
 get language code as a string
static final int Text_GetNbString ()
 get nb of string in current text pack
int Text_GetPhoneDefaultLangage ()
 get phone default langage, if unable to get it, return GLLang.EN (considered as default language)
static String Text_GetString (int index)
 get a string given it's index
static void Text_LoadTextFromPack (String filename, int index1, int index2)
 open and load text from two text packages inside a pack file
static void Text_LoadTextFromPack (String filename, int index)
static final void Text_SetEncoding (String encoding)
 set current text encoding

Variables

static String text_encoding = "UTF-8"
 encoding for text (UTF-8 by default)
static int text_nbString
 number of string in this text pack

Detailed Description

text decoding and caching function


Function Documentation

static void Text_BuildStringCache (  )  [static, package, inherited]

cache all the text into string Array

using this function will store the text in String Array instead of byte Array
byte Array consume less memory, but must allocate a String each time it's needed
String Array consume more heap memory, but only allocate one string once and for all for each text

static void Text_FreeAll (  )  [static, package, inherited]

free all the data-array used by the text

static String Text_FromUTF8 ( byte[]  src,
int  offset,
int  len 
) [static, package, inherited]

get a string from an UTF-8 encoded byte array.

Text_GetString will use this function if the string is encoded with UTF-8 and if the flag text_useInternalUTF8Converter is set.

Parameters:
src UTF-8 encoded byte array.
offset Offset to the start of the string in the src array.
len Length of the string to convert.
Returns:
a String
Note:
This function is slow, used the internal String() convertion if possible.

String Text_GetLanguageAsString ( int  languageCode  )  [package, inherited]

get language code as a string

Parameters:
languageCode language code to get as a string
Returns:
language code as string, or null if invalid language code

static final int Text_GetNbString (  )  [static, package, inherited]

get nb of string in current text pack

Returns:
nb of string in current text pack

int Text_GetPhoneDefaultLangage (  )  [package, inherited]

get phone default langage, if unable to get it, return GLLang.EN (considered as default language)

Returns:
phone default language as defined in GLLang interface
See also:
GLLang

static String Text_GetString ( int  index  )  [static, package, inherited]

get a string given it's index

Parameters:
index index of the string to get
Returns:
a string

static void Text_LoadTextFromPack ( String  filename,
int  index1,
int  index2 
) [static, package, inherited]

open and load text from two text packages inside a pack file

Parameters:
filename name of the pack file
index1 index of the first text package to load
index2 index of the second text package to load
Note:
this function will call automaically Text_BuildStringCache() if GLLibConfig.text_useStringCache is set to true
See also:
GLLibConfig.text_useStringCache

Text_BuildStringCache

static void Text_LoadTextFromPack ( String  filename,
int  index 
) [static, package, inherited]

static final void Text_SetEncoding ( String  encoding  )  [static, package, inherited]

set current text encoding

Parameters:
encoding encoding of the text


Variable Documentation

String text_encoding = "UTF-8" [static, package, inherited]

encoding for text (UTF-8 by default)

int text_nbString [static, package, inherited]

number of string in this text pack


Generated on Tue Sep 23 23:05:31 2008 for GLLib by  doxygen 1.5.2