public final class LdifEntryWriter extends Object implements EntryWriter
Constructor and Description |
---|
LdifEntryWriter(List<String> ldifLines)
Creates a new LDIF entry writer which will append lines of LDIF to the
provided list.
|
LdifEntryWriter(OutputStream out)
Creates a new LDIF entry writer whose destination is the provided output
stream.
|
LdifEntryWriter(Writer writer)
Creates a new LDIF entry writer whose destination is the provided
character stream writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this entry writer, flushing it first.
|
void |
flush()
Flushes this entry writer so that any buffered data is written
immediately to underlying stream, flushing the stream if it is also
Flushable . |
LdifEntryWriter |
setAddUserFriendlyComments(boolean addUserFriendlyComments)
Specifies whether user-friendly comments should be added whenever
distinguished names or UTF-8 attribute values are encountered which
contained non-ASCII characters.
|
LdifEntryWriter |
setExcludeAllOperationalAttributes(boolean excludeOperationalAttributes)
Specifies whether all operational attributes should be excluded
from any entries that are written to LDIF.
|
LdifEntryWriter |
setExcludeAllUserAttributes(boolean excludeUserAttributes)
Specifies whether all user attributes should be excluded from any
entries that are written to LDIF.
|
LdifEntryWriter |
setExcludeAttribute(AttributeDescription attributeDescription)
Excludes the named attribute from any entries that are written to LDIF.
|
LdifEntryWriter |
setExcludeBranch(Dn excludeBranch)
Excludes all entries beneath the named entry (inclusive) from being
written to LDIF.
|
LdifEntryWriter |
setIncludeAttribute(AttributeDescription attributeDescription)
Ensures that the named attribute is not excluded from any entries that
are written to LDIF.
|
LdifEntryWriter |
setIncludeBranch(Dn includeBranch)
Ensures that all entries beneath the named entry (inclusive) are written
to LDIF.
|
LdifEntryWriter |
setIncludeExcludeFilters(Collection<Filter> includeFilters,
Collection<Filter> excludeFilters)
Sets the filters to include / exclude entries.
|
LdifEntryWriter |
setWrapColumn(int wrapColumn)
Specifies the column at which long lines should be wrapped.
|
static String |
toString(Entry entry)
Returns the LDIF string representation of the provided entry.
|
LdifEntryWriter |
writeComment(CharSequence comment)
Writes a comment.
|
LdifEntryWriter |
writeEntry(Entry entry)
Writes an entry.
|
public LdifEntryWriter(List<String> ldifLines)
ldifLines
- The list to which lines of LDIF should be appended.public LdifEntryWriter(OutputStream out)
out
- The output stream to use.public LdifEntryWriter(Writer writer)
writer
- The character stream writer to use.public static String toString(Entry entry)
entry
- The entry.public void close() throws IOException
EntryWriter
close
in interface Closeable
close
in interface AutoCloseable
close
in interface EntryWriter
IOException
- If an unexpected IO error occurred while closing.public void flush() throws IOException
EntryWriter
Flushable
.
If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
flush
in interface Flushable
flush
in interface EntryWriter
IOException
- If an unexpected IO error occurred while flushing.public LdifEntryWriter setAddUserFriendlyComments(boolean addUserFriendlyComments)
false
.addUserFriendlyComments
- true
if user-friendly comments should be added, or
false
otherwise.LdifEntryWriter
.public LdifEntryWriter setExcludeAllOperationalAttributes(boolean excludeOperationalAttributes)
false
.excludeOperationalAttributes
- true
if all operational attributes should be excluded,
or false
otherwise.LdifEntryWriter
.public LdifEntryWriter setExcludeAllUserAttributes(boolean excludeUserAttributes)
false
.excludeUserAttributes
- true
if all user attributes should be excluded, or
false
otherwise.LdifEntryWriter
.public LdifEntryWriter setExcludeAttribute(AttributeDescription attributeDescription)
attributeDescription
- The name of the attribute to be excluded.LdifEntryWriter
.public LdifEntryWriter setExcludeBranch(Dn excludeBranch)
excludeBranch
- The distinguished name of the branch to be excluded.LdifEntryWriter
.public LdifEntryWriter setIncludeAttribute(AttributeDescription attributeDescription)
attributeDescription
- The name of the attribute to be included.LdifEntryWriter
.public LdifEntryWriter setIncludeBranch(Dn includeBranch)
includeBranch
- The distinguished name of the branch to be included.LdifEntryWriter
.public LdifEntryWriter setIncludeExcludeFilters(Collection<Filter> includeFilters, Collection<Filter> excludeFilters)
includeFilters
- entries which match any include filter will be included from LDIF.excludeFilters
- entries which match any exclude filter will be excluded from LDIF.LdifEntryReader
.public LdifEntryWriter setWrapColumn(int wrapColumn)
wrapColumn
- The column at which long lines should be wrapped.LdifEntryWriter
.public LdifEntryWriter writeComment(CharSequence comment) throws IOException
EntryWriter
writeComment
in interface EntryWriter
comment
- The CharSequence
to be written as a comment.IOException
- If an unexpected IO error occurred while writing the comment.public LdifEntryWriter writeEntry(Entry entry) throws IOException
EntryWriter
writeEntry
in interface EntryWriter
entry
- The Entry
to be written.IOException
- If an unexpected IO error occurred while writing the entry.Copyright 2010-2022 ForgeRock AS.