net.sourceforge.wohenchan.convert
Class SunrainConverterTable

java.lang.Object
  |
  +--net.sourceforge.wohenchan.convert.SunrainConverterTable
All Implemented Interfaces:
ConverterTableInterface

public class SunrainConverterTable
extends java.lang.Object
implements ConverterTableInterface

Wrapper around the dictionary at sunrain.net

Version:
$Name: $ $Date: 2003/08/19 16:25:19 $
Author:
$Author: wtanaka $

Constructor Summary
SunrainConverterTable()
           
 
Method Summary
private  void fireEntryFound(ConverterListener listener, ConverterEntryInterface entry)
           
 void lookupByEnglishSubstring(java.lang.String str, ConverterListener listener)
          Locates ConverterEntryInterface objects corresponding to a given case insensitive English substring.
 void lookupByPinyin(java.lang.String pinyin, ConverterListener listener)
          Looks up a dictionary entry by pinyin.
 void lookupBySimplifiedChinese(java.lang.String chinese, ConverterListener listener)
          Looks up a converter table entry by GB2312.
 void lookupByTraditionalChinese(java.lang.String chinese, ConverterListener listener)
          Looks up a converter table entry by traditional chinese characters.
 void parseEnglishToGB(ConverterListener listener, java.io.Reader reader)
          Parses the chinese->english dictionary output for gb2312.
 void parseGB2312ToEnglish(ConverterListener listener, java.io.Reader reader)
          Parses the chinese->english dictionary output for gb2312.
 void parsePinyinToEnglish(ConverterListener listener, java.io.Reader reader)
          Parses the chinese->english dictionary output for pinyin.
private static java.lang.String[] split(java.lang.String string, java.lang.String separator)
           
 java.lang.String toString()
           
private  java.lang.String urlEncode(byte[] bytes)
          Encodes a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SunrainConverterTable

public SunrainConverterTable()
Method Detail

fireEntryFound

private void fireEntryFound(ConverterListener listener,
                            ConverterEntryInterface entry)
                     throws AbortSearchException
AbortSearchException

split

private static java.lang.String[] split(java.lang.String string,
                                        java.lang.String separator)

parsePinyinToEnglish

public void parsePinyinToEnglish(ConverterListener listener,
                                 java.io.Reader reader)
                          throws java.io.IOException,
                                 AbortSearchException
Parses the chinese->english dictionary output for pinyin.

java.io.IOException
AbortSearchException

parseGB2312ToEnglish

public void parseGB2312ToEnglish(ConverterListener listener,
                                 java.io.Reader reader)
                          throws java.io.IOException,
                                 AbortSearchException
Parses the chinese->english dictionary output for gb2312.

java.io.IOException
AbortSearchException

lookupByPinyin

public void lookupByPinyin(java.lang.String pinyin,
                           ConverterListener listener)
Looks up a dictionary entry by pinyin. Reverse Engineered from search form at: sunrain.net. The form takes the following parameters:

Specified by:
lookupByPinyin in interface ConverterTableInterface
Parameters:
pinyin - The input string is specified in pinyin. The string may be composed of the letters 'a'-'z' (lower case only), the numbers '1'-'5' and space (' '). The string is composed of at least 1 space-separated pinyin syllables. Syllables are separated with exactly one space. There is no leading or trailing space. Each syllable is composed of at least two letters followed by exactly one digit. The neutral tone is expicitly specified with '5'. u w/ umlaut (as in luu2 (donkey, palm tree), or luu3 (drizzle) is specified with uu.
listener - the ConverterListener to which this object should send its results
Returns:
a non-null, possibly empty, array of results for this search.

urlEncode

private java.lang.String urlEncode(byte[] bytes)
Encodes a byte array.


lookupBySimplifiedChinese

public void lookupBySimplifiedChinese(java.lang.String chinese,
                                      ConverterListener listener)
Looks up a converter table entry by GB2312.

Specified by:
lookupBySimplifiedChinese in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

lookupByTraditionalChinese

public void lookupByTraditionalChinese(java.lang.String chinese,
                                       ConverterListener listener)
Looks up a converter table entry by traditional chinese characters.

Specified by:
lookupByTraditionalChinese in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

parseEnglishToGB

public void parseEnglishToGB(ConverterListener listener,
                             java.io.Reader reader)
                      throws java.io.IOException,
                             AbortSearchException
Parses the chinese->english dictionary output for gb2312.

java.io.IOException
AbortSearchException

lookupByEnglishSubstring

public void lookupByEnglishSubstring(java.lang.String str,
                                     ConverterListener listener)
Locates ConverterEntryInterface objects corresponding to a given case insensitive English substring.

Specified by:
lookupByEnglishSubstring in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object