code: public static void dumpLdif(LdifOut lo, DirRecord rec) throws NamingException {
      if (rec == null) {
        throw new NamingException("dumpLdif: No record supplied");
      }
  
      String dn = rec.getDn();
      if (dn == null) {
        throw new NamingException("Unable to get dn");
      }
  
      lo.out("dn: " + dn);
  
      int ctype = rec.getChangeType();
  
      if (!rec.getIsContent()) {
        // Emit a changetype attribute
        lo.out("changeType: " + LdifRecord.changeTypes[ctype]);
      }
  
      if ((rec.getIsContent()) || (ctype == DirRecord.changeTypeAdd)) {
        Attributes as = rec.getAttributes();
  
        if (as == null) throw new NamingException("No attributes");
  
        Enumeration e = as.getAll();
  
        while (e.hasMoreElements()) {
          dumpAttr(lo, (Attribute)e.nextElement());
        } // while
      } else if (ctype == DirRecord.changeTypeDelete) {
        lo.out("changetype: delete");
      } else {
        lo.out("changetype: modify");
  
        // Dump changes
        ModificationItem[] mods = rec.getMods();
  
        if (mods == null) {
          lo.out("# Invalid record - no mods");
        } else {
          for (int i = 0; i < mods.length; i ++) {
            ModificationItem m = mods[i];
            int op = m.getModificationOp();
            Attribute a = m.getAttribute();
            String aid = a.getID();
  
            if (op == DirContext.ADD_ATTRIBUTE) {
              lo.out("add: " + aid);
            } else if (op == DirContext.REPLACE_ATTRIBUTE) {
              lo.out("replace: " + aid);
            } else if (op == DirContext.REMOVE_ATTRIBUTE) {
              lo.out("delete: " + aid);
            } else {
              lo.out("# Invalid record - bad mod op " + op);
            }
            dumpAttr(lo, a);
          }
        }
        lo.out("-");
      }
  
      lo.out(""); // null terminator
    }
docs: dumpLdif write the entire record as ldif.