Package netscape.ldap.util
Class LDIFWriter
java.lang.Object
netscape.ldap.util.LDAPWriter
netscape.ldap.util.LDIFWriter
- All Implemented Interfaces:
Serializable
Class for outputting LDAP entries to a stream as LDIF.
- Version:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate booleanprivate booleanprivate Stringprivate booleanprivate static final intFields inherited from class netscape.ldap.util.LDAPWriter
m_pw -
Constructor Summary
ConstructorsConstructorDescriptionConstructs anLDIFWriterobject to output entries to a stream as LDIF.LDIFWriter(PrintWriter pw, boolean attrsOnly, String separator, boolean foldLines, boolean toFiles) Constructs anLDIFWriterobject to output entries to a stream as LDIF. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileOutputStreamgetTempFile(String name) Create a unique file name in the temp folder and open an output stream to the fileprotected voidprintAttribute(LDAPAttribute attr) Print an attribute of an entryprotected voidprintEntryEnd(String dn) Print epilogue to entryprotected voidPrint prologue to entryprotected voidprintString(String value) Methods inherited from class netscape.ldap.util.LDAPWriter
getPrintableValue, printEntry, printSchema
-
Field Details
-
m_sep
-
m_foldLines
private boolean m_foldLines -
m_attrsOnly
private boolean m_attrsOnly -
m_toFiles
private boolean m_toFiles -
DEFAULT_SEPARATOR
- See Also:
-
MAX_LINE
private static final int MAX_LINE- See Also:
-
-
Constructor Details
-
LDIFWriter
Constructs anLDIFWriterobject 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 anLDIFWriterobject to output entries to a stream as LDIF.- Parameters:
pw- output streamattrsOnly-trueif only attribute names, not values, are to be printedseparator- String to use between attribute names and values; the default is ":"foldLines-trueto fold lines at 77 characters,falseto not fold them; the default istrue.toFiles-trueto write each attribute value to a file in the temp folder,falseto write them to the output stream in printable format; the default isfalse.
-
-
Method Details
-
printAttribute
Print an attribute of an entry- Specified by:
printAttributein classLDAPWriter- Parameters:
attr- the attribute to format to the output stream
-
printEntryStart
Print prologue to entry- Specified by:
printEntryStartin classLDAPWriter- Parameters:
dn- the DN of the entry
-
printEntryEnd
Print epilogue to entry- Specified by:
printEntryEndin classLDAPWriter- Parameters:
dn- the DN of the entry
-
printString
-
getTempFile
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
-