Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kr.ac.kaist.swrc.jhannanum.share
Class Code

    java.lang.Object
      kr.ac.kaist.swrc.jhannanum.share.Code

    public class Code

extends java.lang.Object

This class is for code conversion. HanNanum internally uses triple encoding, which represents an Korean eumjeol with three characters - CHOSEONG(beginning consonant), JUNGSEONG(vowel), JONGSEONG(final consonant). This class converts the Korean encoding from unicode to triple encoding, and vice versa.

Author:
  Sangwon Park (hudoni@world.kaist.ac.kr), CILab, SWRC, KAIST
See Also:
  http://www.utf8-chartable.de/unicode-utf8-table.pl

Field Summary
`private static char[]` | `CHOSEONG_LIST` the list of CHOSEONG - beginning consonant
`private static byte[]` | `CHOSEONG_LIST_REV` the list of JONGSEONG for reverse
`static int` | `ENCODING_TRIPLE` triple encoding
`static int` | `ENCODING_UNICODE` unicode
`static char` | `HANGUL_FILLER` hangul filler in unicode
`static int` | `JAMO_CHOSEONG` CHOSEONG(beginning consonant)
`static int` | `JAMO_JONGSEONG` JONGSEONG(final consonant)
`static int` | `JAMO_JUNGSEONG` JUNGSEONG(vowel)
`private static char[]` | `JONGSEONG_LIST` the list of JUNGSEONG - vowel
`private static byte[]` | `JONGSEONG_LIST_REV` the list of JONGSEONG for reverse

Constructor Summary
`Code()`

Method Summary
`static void` | `convertFile(java.lang.String srcFileName, java.lang.String desFileName, int srcEncoding, int desEncoding)` It changes the encoding of text file between UTF-8 and the triple encoding.
`static boolean` | `isChoseong(char c)` It checks whether the specified character is choseong.
`static boolean` | `isJongseong(char c)` It checks whether the specified character is jongseong.
`static boolean` | `isJungseong(char c)` It checks whether the specified character is jungseong.
`static char` | `toChoseong(char jongseong)` It changes the specified jongseong to choseong.
`static char` | `toCompatibilityJamo(char jamo)` Changes the unicode Hangul jamo to unicode compatibility Hangul jamo.
`static char` | `toJamo(char jamo, int flag)` It changes the unicode Hangul compatibility jamo to Hangul jamo - choseong, jungseong, or jongseong.
`static java.lang.String` | `toString(char[] tripleArray)` Converts the encoding of the text from Hangul triple encoding to unicode.
`static java.lang.String` | `toString(char[] tripleArray, int len)` Converts the encoding of the text from Hangul triple encoding to unicode.
`static char` | `toSyllable(char cho, char jung, char jong)` It combines the specified choseong, jungseong, and jongseong to one unicode Hangul syllable.
`static char[]` | `toTripleArray(java.lang.String str)` It converts the encoding of the specified text from unicode to triple encoding.
`static java.lang.String` | `toTripleString(java.lang.String str)` It returns the unicode representation of triple encoding text.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ENCODING_TRIPLE

    public static final int ENCODING_TRIPLE

  triple encoding

  See Also:
    Constant Field Values

### ENCODING_UNICODE

    public static final int ENCODING_UNICODE

  unicode

  See Also:
    Constant Field Values

### JAMO_CHOSEONG

    public static final int JAMO_CHOSEONG

  CHOSEONG(beginning consonant)

  See Also:
    Constant Field Values

### JAMO_JUNGSEONG

    public static final int JAMO_JUNGSEONG

  JUNGSEONG(vowel)

  See Also:
    Constant Field Values

### JAMO_JONGSEONG

    public static final int JAMO_JONGSEONG

  JONGSEONG(final consonant)

  See Also:
    Constant Field Values

### HANGUL_FILLER

    public static final char HANGUL_FILLER

  hangul filler in unicode

  See Also:
    Constant Field Values

### CHOSEONG_LIST

    private static final char[] CHOSEONG_LIST

  the list of CHOSEONG - beginning consonant

### JONGSEONG_LIST

    private static final char[] JONGSEONG_LIST

  the list of JUNGSEONG - vowel

### CHOSEONG_LIST_REV

    private static final byte[] CHOSEONG_LIST_REV

  the list of JONGSEONG for reverse

### JONGSEONG_LIST_REV

    private static final byte[] JONGSEONG_LIST_REV

  the list of JONGSEONG for reverse

Constructor Detail

### Code

    public Code()

Method Detail

### convertFile

    public static void convertFile(java.lang.String srcFileName,
                                   java.lang.String desFileName,
                                   int srcEncoding,
                                   int desEncoding)
                            throws java.io.IOException

  It changes the encoding of text file between UTF-8 and the triple encoding.

  Parameters:
    `srcFileName` - - the input file
    `desFileName` - - the output file
    `srcEncoding` - - the encoding of input file: ENCODING_UNICODE or ENCODING_TRIPLE
    `desEncoding` - - the encoding of input file: ENCODING_UNICODE or ENCODING_TRIPLE
  Throws:
    `java.io.IOException`

### isChoseong

    public static boolean isChoseong(char c)

  It checks whether the specified character is choseong.

  Parameters:
    `c` - - the character to check
  Returns:
    true: the specified character is choseong, false: not choseong

### isJongseong

    public static boolean isJongseong(char c)

  It checks whether the specified character is jongseong.

  Parameters:
    `c` - - the character to check
  Returns:
    true: the specified character is jongseong, false: not jongseong

### isJungseong

    public static boolean isJungseong(char c)

  It checks whether the specified character is jungseong.

  Parameters:
    `c` - - the character to check
  Returns:
    true: the specified character is jungseong, false: not jungseong

### toChoseong

    public static char toChoseong(char jongseong)

  It changes the specified jongseong to choseong.

  Parameters:
    `jongseong` - - the final consonant
  Returns:
    the consonant which is changed from jongseong to choseong

### toCompatibilityJamo

    public static char toCompatibilityJamo(char jamo)

  Changes the unicode Hangul jamo to unicode compatibility Hangul jamo.

  Parameters:
    `jamo` - - unicode Hangul jamo
  Returns:
    the compatibility Hangul jamo

### toJamo

    public static char toJamo(char jamo,
                              int flag)

  It changes the unicode Hangul compatibility jamo to Hangul jamo - choseong, jungseong, or jongseong.

  Parameters:
    `jamo` - - the unicode Hangul compatibility jamo
    `flag` - - JAMO_CHOSEONG or JAMO_JUNGSEONG or JAMO_JONGSEONG
  Returns:
    the unicode Hangul jamo

### toString

    public static java.lang.String toString(char[] tripleArray)

  Converts the encoding of the text from Hangul triple encoding to unicode.

  Parameters:
    `tripleArray` - - the text with the Hangul triple encoding
  Returns:
    the unicode text

### toString

    public static java.lang.String toString(char[] tripleArray,
                                            int len)

  Converts the encoding of the text from Hangul triple encoding to unicode.

  Parameters:
    `tripleArray` - - the text with the Hangul triple encoding
    `len` - - the length of text to convert
  Returns:
    the unicode text

### toSyllable

    public static char toSyllable(char cho,
                                  char jung,
                                  char jong)

  It combines the specified choseong, jungseong, and jongseong to one unicode Hangul syllable.

  Parameters:
    `cho` - - beginning consonant
    `jung` - - vowel
    `jong` - - final consonant
  Returns:
    the combined Hangul syllable

### toTripleArray

    public static char[] toTripleArray(java.lang.String str)

  It converts the encoding of the specified text from unicode to triple encoding.

  Parameters:
    `str` - - the unicode text
  Returns:
    the text represented in the Hangul triple encoding

### toTripleString

    public static java.lang.String toTripleString(java.lang.String str)

  It returns the unicode representation of triple encoding text.

  Parameters:
    `str` - - the unicode text
  Returns:
    the unicode representation of triple encoding text

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD