Package netscape.ldap.util
Class LDIFWriter
- java.lang.Object
-
- netscape.ldap.util.LDAPWriter
-
- netscape.ldap.util.LDIFWriter
-
- All Implemented Interfaces:
java.io.Serializable
public class LDIFWriter extends LDAPWriter
Class for outputting LDAP entries to a stream as LDIF.- Version:
- 1.0
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class netscape.ldap.util.LDAPWriter
m_pw
-
-
Constructor Summary
Constructors Constructor Description LDIFWriter(java.io.PrintWriter pw)
Constructs anLDIFWriter
object to output entries to a stream as LDIF.LDIFWriter(java.io.PrintWriter pw, boolean attrsOnly, java.lang.String separator, boolean foldLines, boolean toFiles)
Constructs anLDIFWriter
object to output entries to a stream as LDIF.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.io.FileOutputStream
getTempFile(java.lang.String name)
Create a unique file name in the temp folder and open an output stream to the fileprotected void
printAttribute(LDAPAttribute attr)
Print an attribute of an entryprotected void
printEntryEnd(java.lang.String dn)
Print epilogue to entryprotected void
printEntryStart(java.lang.String dn)
Print prologue to entryprotected void
printString(java.lang.String value)
-
Methods inherited from class netscape.ldap.util.LDAPWriter
getPrintableValue, printEntry, printSchema
-
-
-
-
Constructor Detail
-
LDIFWriter
public LDIFWriter(java.io.PrintWriter pw)
Constructs anLDIFWriter
object to output entries to a stream as LDIF.- Parameters:
pw
- output stream
-
LDIFWriter
public LDIFWriter(java.io.PrintWriter pw, boolean attrsOnly, java.lang.String separator, boolean foldLines, boolean toFiles)
Constructs anLDIFWriter
object to output entries to a stream as LDIF.- Parameters:
pw
- output streamattrsOnly
-true
if only attribute names, not values, are to be printedseparator
- 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 istrue
.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 isfalse
.
-
-
Method Detail
-
printAttribute
protected void printAttribute(LDAPAttribute attr)
Print an attribute of an entry- Specified by:
printAttribute
in classLDAPWriter
- Parameters:
attr
- the attribute to format to the output stream
-
printEntryStart
protected void printEntryStart(java.lang.String dn)
Print prologue to entry- Specified by:
printEntryStart
in classLDAPWriter
- Parameters:
dn
- the DN of the entry
-
printEntryEnd
protected void printEntryEnd(java.lang.String dn)
Print epilogue to entry- Specified by:
printEntryEnd
in classLDAPWriter
- Parameters:
dn
- the DN of the entry
-
printString
protected void printString(java.lang.String value)
-
getTempFile
protected java.io.FileOutputStream getTempFile(java.lang.String name) throws java.io.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:
java.io.IOException
- if the file couldn't be opened for output
-
-