All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class multilizer.BinaryDictionary

java.lang.Object
   |
   +----multilizer.Dictionary
           |
           +----multilizer.BundleDictionary
                   |
                   +----multilizer.FileDictionary
                           |
                           +----multilizer.BinaryDictionary

public class BinaryDictionary
extends FileDictionary
A dictionary component that gets translation data from a single or multiple MLD files or streams.

Using a Single File or Stream

Set the FileName property to contain the file name of the MLD file.

An example:

 BinaryDictionary dictionary = new BinaryDictionary();
 dictionary.setFileName("dictionary.mld");
 dictionary.open();
 

You can also set the dictionary read the dictionary data from a stream. Write the getTranslationStream event. Create the stream in the event. The stream must contain MLD data.

An example:

 public class SampleFrame implements TranslationStreamListener
 ...
 BinaryDictionary dictionary = new BinaryDictionary();
 dictionary.addTranslationStreamListener(new TranslationStreamListener()
 {
   public void getTranslationStream(StreamEventObject e) throws Exception
   {
     dictionary_getTranslationStream(e);
   }
 });
 dictionary.open();
 ...
 void getTranslationStream(StreamEventObject e) throws Exception
 {
   e.setStream(new FileInputStream(e.getFileName()));
 }
 

Using File or Stream Bundles

Set the FileName property to contain the bundle name. This name specifies the names of the language and translation file. The language file name is "<name>.languages". The translation file name is "<name>_<locale>.mld". The language code is the Java's standard locale code (e.g. "en" and "en_UK").

Language File format
MLD File format

An example that uses a MLD file bundle (e.g. dictionary.languages, dictionary_en.mld, dictionary_fi.mld, etc):

 BinaryDictionary dictionary = new BinaryDictionary();
 dictionary.setFileName("dictionary");
 dictionary.open();
 
You can also set the dictionary read the dictionary data from streams using the events desribed above.

See Also:
TextDictionary, ResourceDictionary

Variable Index

 o MLD_FILE_EXTENSION

Constructor Index

 o BinaryDictionary()

Method Index

 o getLanguageCount()
Gets the amount of the languages in the dictionary.
 o getLanguageData(int)
Gets the specified language.
 o getLanguageDatas()
Gets the all languages.
 o loadTranslation(Vector, String)
Loads the translation data from the file to the array.
 o readLanguage()

Variables

 o MLD_FILE_EXTENSION
 public static final String MLD_FILE_EXTENSION

Constructors

 o BinaryDictionary
 public BinaryDictionary()

Methods

 o readLanguage
 protected Language readLanguage() throws IOException
 o getLanguageCount
 public int getLanguageCount()
Gets the amount of the languages in the dictionary.

Overrides:
getLanguageCount in class BundleDictionary
 o getLanguageData
 public Language getLanguageData(int index)
Gets the specified language.

Overrides:
getLanguageData in class BundleDictionary
 o getLanguageDatas
 public Language[] getLanguageDatas()
Gets the all languages.

Overrides:
getLanguageDatas in class BundleDictionary
 o loadTranslation
 protected void loadTranslation(Vector translations,
                                String fileName)
Loads the translation data from the file to the array.

Overrides:
loadTranslation in class FileDictionary

All Packages  Class Hierarchy  This Package  Previous  Next  Index