public void writeHeaderPart(AnnotatedOutput out) {
    throwIfNotPrepared();

    int sz = typeIds.size();
    int offset = (sz == 0) ? 0 : getFileOffset();

    if (sz > DexFormat.MAX_TYPE_IDX + 1) {
      throw new DexIndexOverflowException(
          String.format(
              "Too many type identifiers to fit in one dex file: %1$d; max is %2$d.%n"
                  + "You may try using multi-dex. If multi-dex is enabled then the list of "
                  + "classes for the boot dex list is too large.",
              items().size(), DexFormat.MAX_MEMBER_IDX + 1));
    }

    if (out.annotates()) {
      out.annotate(4, "type_ids_size:   " + Hex.u4(sz));
      out.annotate(4, "type_ids_off:    " + Hex.u4(offset));
    }

    out.writeInt(sz);
    out.writeInt(offset);
  }
Writes the portion of the file header that refers to this instance.

@param out {@code non-null;} where to write
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/TypeIdsSection.java