7.5. Handling Little-Endian and Big-Endian Dictionaries

The byte order of the binary dictionary must match the byte order of the runtime platform. To use the dictionary on both a little-endian platform (such as an Intel x86 CPU) and a big-endian platform (such as Oracle SPARC), you must generate two binary dictionaries. By default the dictionary compiler uses the byte order of the platform on which it is running. You can change this with the order command line option.

The SDK includes little-endian and big-endian versions of the RBL-JE dictionaries. If you compile both a little-endian and a big-endian user dictionary, you can use the same strategy that the SDK uses for picking the correct RBL-JE dictionary:

Append -LE.bin to the name of the little-endian dictionary and -BE.bin to the name of the big endian dictionary. For example, you could name an English user dictionary userdictENG-LE.bin and userdictENG-BE.bin. Then you could use the following routine to return the correct ending for userdictENG at runtime:

private String dictionarySuffix() {
    if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
        return "-BE.bin";
    } else {
        return "-LE.bin";
    }
}

results matching ""

    No results matching ""