|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.util.LDIFWriter
@PublicAPI(stability=UNCOMMITTED, mayInstantiate=true, mayExtend=false, mayInvoke=true) public final class LDIFWriter
This class provides a mechanism for writing entries in LDIF form to a file or an output stream.
Constructor Summary | |
---|---|
LDIFWriter(LDIFExportConfig exportConfig)
Creates a new LDIF writer with the provided configuration. |
Method Summary | |
---|---|
static void |
appendLDIFSeparatorAndValue(java.lang.StringBuilder buffer,
byte[] valueBytes)
Appends an LDIF separator and properly-encoded form of the given value to the provided buffer. |
void |
close()
Closes the LDIF writer and the underlying output stream or file. |
void |
flush()
Flushes the data written to the output stream or underlying file. |
void |
writeAddChangeRecord(Entry entry)
Writes an add change record for the provided entry. |
void |
writeChangeRecord(ChangeRecordEntry changeRecord)
Writes a change record entry for the provided change record. |
void |
writeComment(Message comment,
int wrapColumn)
Writes the provided comment to the LDIF file, optionally wrapping near the specified column. |
void |
writeDeleteChangeRecord(Entry entry,
boolean commentEntry)
Writes a delete change record for the provided entry, optionally including a comment with the full entry contents. |
boolean |
writeEntries(java.util.Collection<Entry> entries)
Iterates over each entry contained in the map and writes out the entry in LDIF format. |
boolean |
writeEntry(Entry entry)
Writes the provided entry to LDIF. |
static void |
writeLDIFLine(java.lang.StringBuilder line,
java.io.BufferedWriter writer,
boolean wrapLines,
int wrapColumn)
Writes the provided line to LDIF using the provided information. |
void |
writeModifyChangeRecord(DN dn,
java.util.List<Modification> modifications)
Writes a modify change record with the provided information. |
void |
writeModifyDNChangeRecord(DN dn,
RDN newRDN,
boolean deleteOldRDN,
DN newSuperior)
Writes a modify DN change record with the provided information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LDIFWriter(LDIFExportConfig exportConfig) throws java.io.IOException
exportConfig
- The configuration to use for the export. It must not
be null
.
java.io.IOException
- If a problem occurs while opening the writer.Method Detail |
---|
public void writeComment(Message comment, int wrapColumn) throws java.io.IOException
comment
- The comment to be written. Any line breaks that it
contains will be honored, and potentially new line
breaks may be introduced by the wrapping process. It
must not be null
.wrapColumn
- The column at which long lines should be wrapped, or
-1 to indicate that no additional wrapping should be
added. This will override the wrap column setting
specified in the LDIF export configuration.
java.io.IOException
- If a problem occurs while attempting to write the
comment to the LDIF file.public boolean writeEntries(java.util.Collection<Entry> entries) throws java.io.IOException, LDIFException
entries
- The Map containing the entries keyed by DN.
true
of all of the entries were
written out, false
if it was not
because of the export configuration.
java.io.IOException
- If a problem occurs while writing the entry to LDIF.
LDIFException
- If a problem occurs while trying to determine
whether to include the entry in the export.public boolean writeEntry(Entry entry) throws java.io.IOException, LDIFException
entry
- The entry to be written. It must not be null
.
true
if the entry was actually written, or
false
if it was not because of the export
configuration.
java.io.IOException
- If a problem occurs while writing the entry to LDIF.
LDIFException
- If a problem occurs while trying to determine
whether to include the entry in the export.public void writeChangeRecord(ChangeRecordEntry changeRecord) throws java.io.IOException
changeRecord
- The change record entry to be written.
java.io.IOException
- If a problem occurs while writing the change record.public void writeAddChangeRecord(Entry entry) throws java.io.IOException
entry
- The entry to include in the add change record. It must not
be null
.
java.io.IOException
- If a problem occurs while writing the add record.public void writeDeleteChangeRecord(Entry entry, boolean commentEntry) throws java.io.IOException
entry
- The entry to include in the delete change record. It
must not be null
.commentEntry
- Indicates whether to include a comment with the
contents of the entry.
java.io.IOException
- If a problem occurs while writing the delete record.public void writeModifyChangeRecord(DN dn, java.util.List<Modification> modifications) throws java.io.IOException
dn
- The DN of the entry being modified. It must not be
null
.modifications
- The set of modifications to include in the change
record. It must not be null
.
java.io.IOException
- If a problem occurs while writing the modify record.public void writeModifyDNChangeRecord(DN dn, RDN newRDN, boolean deleteOldRDN, DN newSuperior) throws java.io.IOException
dn
- The DN of the entry before the rename. It must not
be null
.newRDN
- The new RDN for the entry. It must not be
null
.deleteOldRDN
- Indicates whether the old RDN value should be removed
from the entry.newSuperior
- The new superior DN for the entry, or
null
if the entry will stay below the
same parent.
java.io.IOException
- If a problem occurs while writing the modify record.public void flush() throws java.io.IOException
java.io.IOException
- If a problem occurs while flushing the output.public void close() throws java.io.IOException
java.io.IOException
- If a problem occurs while closing the writer.public static void appendLDIFSeparatorAndValue(java.lang.StringBuilder buffer, byte[] valueBytes)
buffer
- The buffer to which the information should be
appended. It must not be null
.valueBytes
- The value to append to the buffer. It must not be
null
.public static void writeLDIFLine(java.lang.StringBuilder line, java.io.BufferedWriter writer, boolean wrapLines, int wrapColumn) throws java.io.IOException
line
- The line of information to write. It must not be
null
.writer
- The writer to which the data should be written. It
must not be null
.wrapLines
- Indicates whether to wrap long lines.wrapColumn
- The column at which long lines should be wrapped.
java.io.IOException
- If a problem occurs while writing the information.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |