code: public void printEntry(final Entry entry) throws IOException {
          final ByteStringBuffer buffer = new ByteStringBuffer();
          buffer.append("\t\t<dsml:entry dn=\"");
          buffer.append(entry.getDN());
          buffer.append("\">");
          buffer.append(eol);
          final String[] values = entry.getAttributeValues("objectclass");
          if (values != null) {
              buffer.append("\t\t\t<dsml:objectclass>");
              buffer.append(eol);
              for (final String value : values) {
                  buffer.append("\t\t\t\t<dsml:oc-value>");
                  buffer.append(value);
                  buffer.append("</dsml:oc-value>");
                  buffer.append(eol);
              }
              buffer.append("\t\t\t</dsml:objectclass>");
              buffer.append(eol);
          }
          for (final Attribute attribute : entry.getAttributes()) {
              final String name = attribute.getName();
              if (!name.equals("objectclass")) {
                  buffer.append("\t\t\t<dsml:attr name=\"");
                  buffer.append(name);
                  buffer.append("\">");
                  buffer.append(eol);
                  for (final String value : attribute.getValues()) {
                      buffer.append("\t\t\t\t<dsml:value>");
                      buffer.append(value);
                      buffer.append("</dsml:value>");
                      buffer.append(eol);
                  }
                  buffer.append("\t\t\t</dsml:attr>");
                  buffer.append(eol);
              }
          }
          buffer.append("\t\t</dsml:entry>");
          buffer.append(eol);
          ldifOutputStream.write(buffer.toByteArray());
      }
docs: Writes an individual LDAP directory entry to the DSML file.
  
  @param entry The directory entry.
  @throws IOException If there was a problem writing to the underlying output stream.