Package org.ldaptive.io
Class LdifWriter
- java.lang.Object
-
- org.ldaptive.io.LdifWriter
-
- All Implemented Interfaces:
SearchResultWriter
public class LdifWriter extends Object implements SearchResultWriter
Writes aSearchResponse
as LDIF to aWriter
.
-
-
Field Summary
Fields Modifier and Type Field Description private Writer
ldifWriter
Writer to write to.private static String
LINE_SEPARATOR
Line separator.
-
Constructor Summary
Constructors Constructor Description LdifWriter(Writer writer)
Creates a new ldif writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createLdif(SearchResponse result)
Creates an LDIF using the supplied search result.protected String
createLdifEntry(LdapEntry entry)
Creates an LDIF using the supplied ldap entry.protected String
createSearchReference(SearchResultReference ref)
Creates an LDIF using the supplied search reference.void
write(SearchResponse result)
Writes the supplied search result to the writer.
-
-
-
Constructor Detail
-
LdifWriter
public LdifWriter(Writer writer)
Creates a new ldif writer.- Parameters:
writer
- to write LDIF to
-
-
Method Detail
-
write
public void write(SearchResponse result) throws IOException
Writes the supplied search result to the writer.- Specified by:
write
in interfaceSearchResultWriter
- Parameters:
result
- search result to write- Throws:
IOException
- if an error occurs using the writer
-
createLdif
protected String createLdif(SearchResponse result)
Creates an LDIF using the supplied search result.- Parameters:
result
- search result- Returns:
- LDIF
-
createLdifEntry
protected String createLdifEntry(LdapEntry entry)
Creates an LDIF using the supplied ldap entry.- Parameters:
entry
- ldap entry- Returns:
- LDIF
-
createSearchReference
protected String createSearchReference(SearchResultReference ref)
Creates an LDIF using the supplied search reference.- Parameters:
ref
- search reference- Returns:
- LDIF
-
-