Ejemplo n.º 1
0
 private static byte[] readByteTable(DataInputStream in) throws IOException {
   if (in.read() != 't') throw new IOException("UnicodeNameMap file corrupt, byte table");
   int n = in.readUnsignedShort();
   byte[] table = new byte[n];
   in.readFully(table);
   return table;
 }
Ejemplo n.º 2
0
  private static char[] readCharTable(DataInputStream in) throws IOException {
    if (in.read() != 't') throw new IOException("UnicodeNameMap file corrupt, chartable");

    int n = in.readUnsignedShort() / 2;
    char[] table = new char[n];
    for (int i = 0; i < n; i++) {
      table[i] = in.readChar();
    }
    return table;
  }
Ejemplo n.º 3
0
  public static void loadTables() throws Exception {
    InputStream instream = ucnhash.class.getResourceAsStream("ucnhash.dat");
    if (instream == null)
      throw new IOException("Unicode name database not found: " + "ucnhash.dat");

    DataInputStream in = new DataInputStream(new BufferedInputStream(instream));

    n = in.readShort();
    m = in.readShort();
    minchar = in.readShort();
    maxchar = in.readShort();
    alphasz = in.readShort();
    maxlen = in.readShort();
    maxidx = maxlen * alphasz - minchar;

    G = readShortTable(in);
    if (in.readShort() != 3)
      throw new IOException("UnicodeNameMap file corrupt, " + "unknown dimension");

    T0 = readShortTable(in);
    T1 = readShortTable(in);
    T2 = readShortTable(in);

    wordoffs = readShortTable(in);
    worddata = readByteTable(in);

    wordstart = in.readShort();
    wordcutoff = in.readShort();
    maxklen = in.readShort();

    rawdata = readByteTable(in);
    rawindex = readCharTable(in);
    codepoint = readCharTable(in);
  }