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 aSearchResponseas LDIF to aWriter.
-
-
Field Summary
Fields Modifier and Type Field Description private WriterldifWriterWriter to write to.private static StringLINE_SEPARATORLine 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 StringcreateLdif(SearchResponse result)Creates an LDIF using the supplied search result.protected StringcreateLdifEntry(LdapEntry entry)Creates an LDIF using the supplied ldap entry.protected StringcreateSearchReference(SearchResultReference ref)Creates an LDIF using the supplied search reference.voidwrite(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:
writein 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
-
-