public class LDIFWriter
extends java.lang.Object
This class provides a set of methods to write an LDIF entry to the file.
Constructor and Description |
---|
LDIFWriter()
Default Constructor, Creates a Writer stream to the standard output.
|
LDIFWriter(java.io.File fileObj)
Creates a Writer stream to the specified file for writing the LDIF data.
|
LDIFWriter(java.io.File fileObj, boolean wrap)
Creates a Writer stream to the specified file for writing the LDIF data.
|
LDIFWriter(java.io.OutputStream out)
Creates a Writer Stream using the specified output stream object for writing the LDIF data.
|
LDIFWriter(java.io.OutputStream out, boolean wrap)
Creates a Writer Stream using the specified output stream object for writing the LDIF data.
|
LDIFWriter(java.io.OutputStream out, java.lang.String enc) |
LDIFWriter(java.lang.String file)
Creates a Writer stream to the specified file for writing the LDIF data.
|
LDIFWriter(java.lang.String file, boolean wrap)
Creates a Writer stream to the specified file for writing the LDIF data.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
static void |
main(java.lang.String[] args) |
void |
newLine()
Write a line separator.
|
void |
setMaxLineLen(int maxLineLen)
Use this method to set the maximum nubmer of chars that could be written in a line.
|
void |
setWrap(boolean wrap)
Use this method to specify should the wrapping of the attribute value done or not.
|
void |
writeComment(java.lang.String comment)
use this method to add a comment line to the LDIF file.
|
void |
writeEntry(LDIFRecord ldifRecord)
Use this method to write an
LDIFRecord to a file. |
void |
writeEntry(java.util.Vector vEntry)
Use this method to write an LDIF entry to the file.
|
void |
writeEntryAsComment(LDIFRecord ldifRecord)
Use this method to write an
LDIFRecord to a file as a commented entry. |
public LDIFWriter() throws java.io.IOException
java.io.IOException
- An I/O error has occurred.public LDIFWriter(java.lang.String file) throws java.io.IOException
file
- the name of the LDIF filejava.io.IOException
- An I/O error has occurred.public LDIFWriter(java.io.File fileObj) throws java.io.IOException
fileObj
- The file oject of the LDIF filejava.io.IOException
- An I/O error has occurred.public LDIFWriter(java.io.OutputStream out) throws java.io.IOException
out
- stream on to which the LDIF data needs to be written.java.io.IOException
- An I/O error has occurred.public LDIFWriter(java.io.OutputStream out, java.lang.String enc) throws java.io.IOException
java.io.IOException
public LDIFWriter(java.lang.String file, boolean wrap) throws java.io.IOException
file
- the name of the LDIF filewrap
- if true and the attribute value has more characters than max line length then the line will be wrappedjava.io.IOException
- An I/O error has occurred.public LDIFWriter(java.io.File fileObj, boolean wrap) throws java.io.IOException
fileObj
- The file oject of the LDIF filewrap
- if true and the attribute value has more characters than max line length then the line will be wrappedjava.io.IOException
- An I/O error has occurred.public LDIFWriter(java.io.OutputStream out, boolean wrap) throws java.io.IOException
out
- stream on to which the LDIF data needs to be written.wrap
- if true and the attribute value has more characters than max line length then the line will be wrappedjava.io.IOException
- An I/O error has occurred.public void newLine() throws java.io.IOException
java.io.IOException
- If an I/O error occurspublic void setMaxLineLen(int maxLineLen)
maxLineLen
- The maximum number of characters in a line.public void setWrap(boolean wrap)
wrap
- if true and the attribute value has more characters than max line length then the line will be wrappedpublic void writeEntry(LDIFRecord ldifRecord) throws java.io.IOException
LDIFRecord
to a file.ldifRecord
- a LDIFRecord object.java.io.IOException
- If an I/O error occurs.public void writeEntryAsComment(LDIFRecord ldifRecord) throws java.io.IOException
LDIFRecord
to a file as a commented entry.ldifRecord
- a LDIFRecord object.java.io.IOException
- If an I/O error occurs.public void writeEntry(java.util.Vector vEntry) throws java.io.IOException
vEntry
- A vector containing the Attribute Names:Values as elements.java.io.IOException
- If an I/O error occurs.public void writeComment(java.lang.String comment) throws java.io.IOException
comment
- the Comment string which is to be added to the LDIF filejava.io.IOException
- If an I/O error occurs.public void close() throws java.io.IOException
java.io.IOException
- If an error occurs.public static void main(java.lang.String[] args)