Пример #1
0
  private Convertor() {
    int i1, i2;

    this.ucs2bytes = new byte[64 * 1024];
    this.big5bytes = new byte[128 * 1024];

    Convertor.readFile("conv/ucs2.txt", this.ucs2bytes);
    Convertor.readFile("conv/big5.txt", this.big5bytes);

    this.ucs2chars = new char[this.ucs2bytes.length / 2];

    // 把讀進來的 ucs2 bytes 處理成標準的 (ucs2) char
    for (int i = 0; i < this.ucs2bytes.length; i += 2) {
      i1 = (this.ucs2bytes[i] < 0 ? 256 : 0) + this.ucs2bytes[i];
      i2 = (this.ucs2bytes[i + 1] < 0 ? 256 : 0) + this.ucs2bytes[i + 1];
      this.ucs2chars[i / 2] = (char) (i1 << 8 | i2);
    }
  }