@Override
    public void write(DataWriter out) throws IOException {
        // write empty type tree if types are not embedded
        if (!embedded) {
            out.writeInt(0);
            return;
        }

        int numBaseClasses = typeMap.size();
        out.writeInt(numBaseClasses);

        for (TypeRoot bc : typeMap.values()) {
            int classID = bc.classID();
            out.writeInt(classID);

            Node<T> node = bc.nodes();

            writeNode(out, node);
        }
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-core/src/main/java/info/ata4/junity/serialize/typetree/TypeTreeV1.java