Example #1
0
  private void writeClassTable(PackedDataOutputStream stream) throws IOException {
    stream.writePackedU32(classTable.size());

    // Zero is reserved for null
    int pos = 1;
    for (Map.Entry<DotName, Integer> entry : classTable.entrySet()) {
      entry.setValue(pos++);
      DotName name = entry.getKey();
      assert !name.isComponentized();

      int nameDepth = 0;
      for (DotName prefix = name.prefix(); prefix != null; prefix = prefix.prefix()) nameDepth++;

      stream.writePackedU32(nameDepth);
      stream.writeUTF(name.local());
    }
  }
Example #2
0
  private void addClassName(DotName name) {
    if (!classTable.containsKey(name)) classTable.put(name, null);

    DotName prefix = name.prefix();
    if (prefix != null) addClassName(prefix);
  }