Class LDIFWriter

java.lang.Object
netscape.ldap.util.LDAPWriter
netscape.ldap.util.LDIFWriter
All Implemented Interfaces:
Serializable

public class LDIFWriter extends LDAPWriter
Class for outputting LDAP entries to a stream as LDIF.
Version:
1.0
See Also:
  • Constructor Details

    • LDIFWriter

      public LDIFWriter(PrintWriter pw)
      Constructs an LDIFWriter object to output entries to a stream as LDIF.
      Parameters:
      pw - output stream
    • LDIFWriter

      public LDIFWriter(PrintWriter pw, boolean attrsOnly, String separator, boolean foldLines, boolean toFiles)
      Constructs an LDIFWriter object to output entries to a stream as LDIF.
      Parameters:
      pw - output stream
      attrsOnly - true if only attribute names, not values, are to be printed
      separator - String to use between attribute names and values; the default is ":"
      foldLines - true to fold lines at 77 characters, false to not fold them; the default is true.
      toFiles - true to write each attribute value to a file in the temp folder, false to write them to the output stream in printable format; the default is false.
  • Method Details

    • printAttribute

      protected void printAttribute(LDAPAttribute attr)
      Print an attribute of an entry
      Specified by:
      printAttribute in class LDAPWriter
      Parameters:
      attr - the attribute to format to the output stream
    • printEntryStart

      protected void printEntryStart(String dn)
      Print prologue to entry
      Specified by:
      printEntryStart in class LDAPWriter
      Parameters:
      dn - the DN of the entry
    • printEntryEnd

      protected void printEntryEnd(String dn)
      Print epilogue to entry
      Specified by:
      printEntryEnd in class LDAPWriter
      Parameters:
      dn - the DN of the entry
    • printString

      protected void printString(String value)
    • getTempFile

      protected FileOutputStream getTempFile(String name) throws IOException
      Create a unique file name in the temp folder and open an output stream to the file
      Parameters:
      name - base name of file; an extension is appended which consists of a number that makes the name unique
      Returns:
      an open output stream to the file
      Throws:
      IOException - if the file couldn't be opened for output