示例#1
0
  private TreeFormatter build() {
    byte[] nameBuf = new byte[OBJECT_ID_STRING_LENGTH];
    int nameLen = OBJECT_ID_STRING_LENGTH - prefixLen;
    TreeFormatter fmt = new TreeFormatter(treeSize(nameLen));
    NonNoteEntry e = nonNotes;

    for (int i = 0; i < cnt; i++) {
      Note n = notes[i];

      n.copyTo(nameBuf, 0);

      while (e != null && e.pathCompare(nameBuf, prefixLen, nameLen, REGULAR_FILE) < 0) {
        e.format(fmt);
        e = e.next;
      }

      fmt.append(nameBuf, prefixLen, nameLen, REGULAR_FILE, n.getData());
    }

    for (; e != null; e = e.next) e.format(fmt);
    return fmt;
  }
示例#2
0
 private int treeSize(final int nameLen) {
   int sz = cnt * TreeFormatter.entrySize(REGULAR_FILE, nameLen);
   for (NonNoteEntry e = nonNotes; e != null; e = e.next) sz += e.treeEntrySize();
   return sz;
 }