oracle.ldap.util
Class LDIFReader

java.lang.Object
  |
  +--oracle.ldap.util.LDIFReader

public class LDIFReader
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. LDIF Data can describe a set of changes that needs to 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 read and manipulate an LDIF file.


Constructor Summary
LDIFReader()
          Default Constructor, Reads the data from standard input.
LDIFReader(java.io.File fileObj)
          Constructs an Input stream reader to read the LDIF data from the file object specified.
LDIFReader(java.io.InputStream ds)
          Constructs an Input stream reader to read the LDIF data from the specified input stream.
LDIFReader(java.lang.String file)
          Constructs an Input stream reader to read the LDIF data from the file specified.
 
Method Summary
 void close()
          Closes the stream.
static void main(java.lang.String[] args)
          Test driver - to read the ldif file and print each record.
 java.util.Vector nextEntry()
          Returns the next entry in the LDIF file.
 LDIFRecord nextRecord()
          Returns the next record in the LDIF file.
 void setReadFileContentForAttrib(boolean bool)
          if set, the attribute value will be treated as a file name and the contents of which will be taken as the attribute value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDIFReader

public LDIFReader()
           throws java.io.IOException
Default Constructor, Reads the data from standard input. The input data is required to be present in UTF8 format.
Throws:
java.io.IOException - If an I/O error occurs.

LDIFReader

public LDIFReader(java.lang.String file)
           throws java.io.IOException
Constructs an Input stream reader to read the LDIF data from the file specified.
Parameters:
file - the name of the LDIF file
Throws:
java.io.IOException - If an I/O error occurs.

LDIFReader

public LDIFReader(java.io.File fileObj)
           throws java.io.IOException
Constructs an Input stream reader to read the LDIF data from the file object specified.
Parameters:
fileObj - The file object of the LDIF file
Throws:
java.io.IOException - If an I/O error occurs.

LDIFReader

public LDIFReader(java.io.InputStream ds)
           throws java.io.IOException
Constructs an Input stream reader to read the LDIF data from the specified input stream.
Parameters:
dstThe - input stream providing the LDIF data
Throws:
java.io.IOException - If an I/O error occurs.
Method Detail

nextEntry

public java.util.Vector nextEntry()
                           throws java.io.IOException
Returns the next entry in the LDIF file. Using this method you can iterate thru all the entries in the LDIF file.
Returns:
the next entry as a vector object containing the attributes as name:value pairs.i.e each element in the vector will look like name:vlaue. A null is returned if there are no more entries.
Throws:
java.io.IOException - If an I/O error occurs.

nextRecord

public LDIFRecord nextRecord()
                      throws java.io.IOException
Returns the next record in the LDIF file. Using this method you can iterate thru all the entries in the LDIF file.
Returns:
the next entry as a LDIFRecord object. A null is returned if there are no more entries.
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.

setReadFileContentForAttrib

public void setReadFileContentForAttrib(boolean bool)
if set, the attribute value will be treated as a file name and the contents of which will be taken as the attribute value. in case of unix the file name begins with '/' and in case of NT the file name contains ':'
Parameters:
bool - boolean value to be set.

main

public static void main(java.lang.String[] args)
Test driver - to read the ldif file and print each record.
Parameters:
args - name of the LDIF file to read