|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.ldap.sdk.EntrySource
com.unboundid.ldif.LDIFEntrySource
@ThreadSafety(level=NOT_THREADSAFE) public final class LDIFEntrySource
This class provides an EntrySource that will read entries from an
LDIF file.
LDIFEntrySource entrySource =
new LDIFEntrySource(new LDIFReader(pathToLDIFFile));
int entriesRead = 0;
int errorsEncountered = 0;
try
{
while (true)
{
try
{
Entry entry = entrySource.nextEntry();
if (entry == null)
{
// There are no more entries to be read.
break;
}
else
{
// Do something with the entry here.
entriesRead++;
}
}
catch (EntrySourceException e)
{
// Some kind of problem was encountered (e.g., a malformed entry
// found in the LDIF file, or an I/O error when trying to read). See
// if we can continue reading entries.
errorsEncountered++;
if (! e.mayContinueReading())
{
break;
}
}
}
}
finally
{
entrySource.close();
}
| Constructor Summary | |
|---|---|
LDIFEntrySource(LDIFReader ldifReader)
Creates a new LDAP entry source that will obtain entries from the provided LDIF reader. |
|
| Method Summary | |
|---|---|
void |
close()
Indicates that this entry source will no longer be needed and any resources associated with it may be closed. |
Entry |
nextEntry()
Retrieves the next entry from the entry source, if there is at least one remaining entry. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LDIFEntrySource(LDIFReader ldifReader)
ldifReader - The LDIF reader from which to read entries. It must
not be null.| Method Detail |
|---|
public Entry nextEntry()
throws EntrySourceException
nextEntry in class EntrySourcenull if there are
no more entries to retrieve..
EntrySourceException - If a problem occurs while attempting to read
the next entry from the entry source.public void close()
close in class EntrySource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||