Package org.forgerock.opendj.ldif
Interface EntryWriter
- All Superinterfaces:
AutoCloseable
,Closeable
,Flushable
- All Known Implementing Classes:
ConnectionEntryWriter
,LdifEntryWriter
An interface for writing entries to a data source, typically an LDIF file.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 alsoFlushable
.writeComment
(CharSequence comment) Writes a comment.writeEntry
(Entry entry) Writes an entry.
-
Method Details
-
close
Closes this entry writer, flushing it first. Closing a previously closed entry writer has no effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- If an unexpected IO error occurred while closing.
-
flush
Flushes this entry writer so that any buffered data is written immediately to underlying stream, flushing the stream if it is alsoFlushable
.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.
- Specified by:
flush
in interfaceFlushable
- Throws:
IOException
- If an unexpected IO error occurred while flushing.
-
writeComment
Writes a comment.- Parameters:
comment
- TheCharSequence
to be written as a comment.- Returns:
- A reference to this entry writer.
- Throws:
IOException
- If an unexpected IO error occurred while writing the comment.NullPointerException
- Ifcomment
wasnull
.
-
writeEntry
Writes an entry.- Parameters:
entry
- TheEntry
to be written.- Returns:
- A reference to this entry writer.
- Throws:
IOException
- If an unexpected IO error occurred while writing the entry.NullPointerException
- Ifentry
wasnull
.
-