Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


oracle.ldap.util
Class LDIFWriter

java.lang.Object
  extended by oracle.ldap.util.LDIFWriter


public class LDIFWriter
extends java.lang.Object

LDAP Data Interchange Format (LDIF) is a file format used to represent the Directory entries. The data from the directory can be exported in this format and could be imported into another directory server. The Import and export of the directory data from an LDAP server can describe a set of changes that can be applied to data in a directory. This format is described in the Internet draft The LDAP Data Interchange Format (LDIF) - RFC-2849.

This class provides a set of methods to write an LDIF entry to the file.


Constructor Summary
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.

 

Method Summary
 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.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

LDIFWriter

public LDIFWriter()
           throws java.io.IOException
Default Constructor, Creates a Writer stream to the standard output. Since the file name is not specified the LDIF data is redirected to the standard output. The output data is written in UTF8 format. If the attribute value contains more characters than max line len then it will not be wrapped.
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.lang.String file)
           throws java.io.IOException
Creates a Writer stream to the specified file for writing the LDIF data. If the attribute value contains more characters than max line length then it will not be wrapped.
Parameters:
file - the name of the LDIF file
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.io.File fileObj)
           throws java.io.IOException
Creates a Writer stream to the specified file for writing the LDIF data. If the attribute value contains more characters than max line length then it will not be wrapped.
Parameters:
fileObj - The file oject of the LDIF file
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.io.OutputStream out)
           throws java.io.IOException
Creates a Writer Stream using the specified output stream object for writing the LDIF data. If the attribute value contains more characters than max line length then it will not be wrapped.
Parameters:
out - stream on to which the LDIF data needs to be written.
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.io.OutputStream out,
                  java.lang.String enc)
           throws java.io.IOException
Throws:
java.io.IOException

LDIFWriter

public LDIFWriter(java.lang.String file,
                  boolean wrap)
           throws java.io.IOException
Creates a Writer stream to the specified file for writing the LDIF data. If the attribute value contains more characters than max line length then it will be wrapped to next line with a space char appended before.
Parameters:
file - the name of the LDIF file
wrap - if true and the attribute value has more characters than max line length then the line will be wrapped
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.io.File fileObj,
                  boolean wrap)
           throws java.io.IOException
Creates a Writer stream to the specified file for writing the LDIF data. If the attribute value contains more characters than max line length then it will be wrapped to next line with a space the first character.
Parameters:
fileObj - The file oject of the LDIF file
wrap - if true and the attribute value has more characters than max line length then the line will be wrapped
Throws:
java.io.IOException - An I/O error has occurred.

LDIFWriter

public LDIFWriter(java.io.OutputStream out,
                  boolean wrap)
           throws java.io.IOException
Creates a Writer Stream using the specified output stream object for writing the LDIF data. If the attribute value contains more characters than max line length then it will be wrapped to next line with a space as the first character.
Parameters:
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 wrapped
Throws:
java.io.IOException - An I/O error has occurred.

Method Detail

newLine

public void newLine()
             throws java.io.IOException
Write a line separator. The value of the line seperator is as defined by the system property line.separator, and it is not neccessary for the value to be a newline ('\n') character.
Throws:
java.io.IOException - If an I/O error occurs

setMaxLineLen

public void setMaxLineLen(int maxLineLen)
Use this method to set the maximum nubmer of chars that could be written in a line.
Parameters:
maxLineLen - The maximum number of characters in a line.

setWrap

public void setWrap(boolean wrap)
Use this method to specify should the wrapping of the attribute value done or not.
Parameters:
wrap - if true and the attribute value has more characters than max line length then the line will be wrapped

writeEntry

public void writeEntry(LDIFRecord ldifRecord)
                throws java.io.IOException
Use this method to write an LDIFRecord to a file.
Parameters:
ldifRecord - a LDIFRecord object.
Throws:
java.io.IOException - If an I/O error occurs.

writeEntryAsComment

public void writeEntryAsComment(LDIFRecord ldifRecord)
                         throws java.io.IOException
Use this method to write an LDIFRecord to a file as a commented entry.
Parameters:
ldifRecord - a LDIFRecord object.
Throws:
java.io.IOException - If an I/O error occurs.

writeEntry

public void writeEntry(java.util.Vector vEntry)
                throws java.io.IOException
Use this method to write an LDIF entry to the file.
Parameters:
vEntry - A vector containing the Attribute Names:Values as elements.
Throws:
java.io.IOException - If an I/O error occurs.

writeComment

public void writeComment(java.lang.String comment)
                  throws java.io.IOException
use this method to add a comment line to the LDIF file.
Parameters:
comment - the Comment string which is to be added to the LDIF file
Throws:
java.io.IOException - If an I/O error occurs.

close

public void close()
           throws java.io.IOException
Closes the stream.
Throws:
java.io.IOException - If an error occurs.

main

public static void main(java.lang.String[] args)

Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


Copyright © 1999, 2009 Oracle. All Rights Reserved.