< prev index next >

src/java.base/share/classes/java/lang/CharacterName.java

Print this page




  42     private final byte[] strPool;
  43     private final int[] lookup;      // code point -> offset/len in strPool
  44     private final int[] bkIndices;   // code point -> lookup index
  45 
  46     // name -> hash -> hsIndices -> cpEntries -> code point
  47     private final int[] cpEntries;   // code points that have name in strPool
  48     private final int[] hsIndices;   // chain heads, hash indices into "cps"
  49 
  50     private CharacterName()  {
  51         try (DataInputStream dis = new DataInputStream(new InflaterInputStream(
  52             AccessController.doPrivileged(new PrivilegedAction<>() {
  53                 public InputStream run() {
  54                     return getClass().getResourceAsStream("uniName.dat");
  55                 }
  56             })))) {
  57 
  58             int total = dis.readInt();
  59             int bkNum = dis.readInt();
  60             int cpNum = dis.readInt();
  61             int cpEnd = dis.readInt();
  62             byte ba[] = new byte[cpEnd];
  63             lookup = new int[bkNum * 256];
  64             bkIndices = new int[(Character.MAX_CODE_POINT + 1) >> 8];
  65             strPool = new byte[total - cpEnd];
  66             cpEntries = new int[cpNum * 3];
  67             hsIndices = new int[(cpNum / 2) | 1];
  68             Arrays.fill(bkIndices, -1);
  69             Arrays.fill(hsIndices, -1);
  70             dis.readFully(ba);
  71             dis.readFully(strPool);
  72 
  73             int nameOff = 0;
  74             int cpOff = 0;
  75             int cp = 0;
  76             int bk = -1;
  77             int prevBk = -1;   // prev bkNo;
  78             int idx = 0;
  79             int next = -1;
  80             int hash = 0;
  81             int hsh = 0;
  82             do {




  42     private final byte[] strPool;
  43     private final int[] lookup;      // code point -> offset/len in strPool
  44     private final int[] bkIndices;   // code point -> lookup index
  45 
  46     // name -> hash -> hsIndices -> cpEntries -> code point
  47     private final int[] cpEntries;   // code points that have name in strPool
  48     private final int[] hsIndices;   // chain heads, hash indices into "cps"
  49 
  50     private CharacterName()  {
  51         try (DataInputStream dis = new DataInputStream(new InflaterInputStream(
  52             AccessController.doPrivileged(new PrivilegedAction<>() {
  53                 public InputStream run() {
  54                     return getClass().getResourceAsStream("uniName.dat");
  55                 }
  56             })))) {
  57 
  58             int total = dis.readInt();
  59             int bkNum = dis.readInt();
  60             int cpNum = dis.readInt();
  61             int cpEnd = dis.readInt();
  62             byte[] ba = new byte[cpEnd];
  63             lookup = new int[bkNum * 256];
  64             bkIndices = new int[(Character.MAX_CODE_POINT + 1) >> 8];
  65             strPool = new byte[total - cpEnd];
  66             cpEntries = new int[cpNum * 3];
  67             hsIndices = new int[(cpNum / 2) | 1];
  68             Arrays.fill(bkIndices, -1);
  69             Arrays.fill(hsIndices, -1);
  70             dis.readFully(ba);
  71             dis.readFully(strPool);
  72 
  73             int nameOff = 0;
  74             int cpOff = 0;
  75             int cp = 0;
  76             int bk = -1;
  77             int prevBk = -1;   // prev bkNo;
  78             int idx = 0;
  79             int next = -1;
  80             int hash = 0;
  81             int hsh = 0;
  82             do {


< prev index next >