public final class LdifEntryReader extends Object implements EntryReader
Constructor and Description |
---|
LdifEntryReader(InputStream in)
Creates a new LDIF entry reader whose source is the provided input
stream.
|
LdifEntryReader(List<String> ldifLines)
Creates a new LDIF entry reader which will read lines of LDIF from the
provided list of LDIF lines.
|
LdifEntryReader(Reader reader)
Creates a new LDIF entry reader whose source is the provided character
stream reader.
|
LdifEntryReader(String... ldifLines)
Creates a new LDIF entry reader which will read lines of LDIF from the
provided array of LDIF lines.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this entry reader if it is not already closed.
|
boolean |
hasNext()
Returns
true if this reader contains another entry, blocking if
necessary until either the next entry is available or the end of the
stream is reached. |
Entry |
readEntry()
Reads the next entry, blocking if necessary until an entry is available.
|
LdifEntryReader |
setExcludeAllOperationalAttributes(boolean excludeOperationalAttributes)
Specifies whether all operational attributes should be excluded
from any entries that are read from LDIF.
|
LdifEntryReader |
setExcludeAllUserAttributes(boolean excludeUserAttributes)
Specifies whether all user attributes should be excluded from any
entries that are read from LDIF.
|
LdifEntryReader |
setExcludeAttribute(AttributeDescription attributeDescription)
Excludes the named attribute from any entries that are read from LDIF.
|
LdifEntryReader |
setExcludeBranch(Dn excludeBranch)
Excludes all entries beneath the named entry (inclusive) from being read
from LDIF.
|
LdifEntryReader |
setExcludeFilter(Matcher excludeFilter)
Excludes all entries which match the provided filter matcher from being
read from LDIF.
|
LdifEntryReader |
setIncludeAttribute(AttributeDescription attributeDescription)
Ensures that the named attribute is not excluded from any entries that
are read from LDIF.
|
LdifEntryReader |
setIncludeBranch(Dn includeBranch)
Ensures that all entries beneath the named entry (inclusive) are read
from LDIF.
|
LdifEntryReader |
setIncludeFilter(Matcher includeFilter)
Ensures that all entries which match the provided filter matcher are read
from LDIF.
|
LdifEntryReader |
setRejectedLdifListener(RejectedLdifListener listener)
Sets the rejected record listener which should be notified whenever an
LDIF record is skipped, malformed, or fails schema validation.
|
LdifEntryReader |
setSchema(Schema schema)
Sets the schema which should be used for decoding entries that are read
from LDIF.
|
LdifEntryReader |
setSchemaValidationPolicy(SchemaValidationPolicy policy)
Specifies the schema validation which should be used when reading LDIF
entry records.
|
static Entry |
valueOfLdifEntry(String... ldifLines)
Parses the provided array of LDIF lines as a single LDIF entry.
|
public LdifEntryReader(InputStream in)
in
- The input stream to use.NullPointerException
- If in
was null
.public LdifEntryReader(List<String> ldifLines)
ldifLines
- The lines of LDIF to be read.NullPointerException
- If ldifLines
was null
.public LdifEntryReader(Reader reader)
reader
- The character stream reader to use.NullPointerException
- If reader
was null
.public LdifEntryReader(String... ldifLines)
ldifLines
- The lines of LDIF to be read.NullPointerException
- If ldifLines
was null
.public static Entry valueOfLdifEntry(String... ldifLines)
ldifLines
- The lines of LDIF to be parsed.LocalizedIllegalArgumentException
- If ldifLines
did not contain an LDIF entry, if it
contained multiple entries, if contained malformed LDIF, or
if the entry could not be decoded using the default schema.NullPointerException
- If ldifLines
was null
.public void close() throws IOException
EntryReader
EntryReader.readEntry()
has returned null
.close
in interface Closeable
close
in interface AutoCloseable
close
in interface EntryReader
IOException
- If an unexpected IO error occurred while closing.public boolean hasNext() throws IOException
true
if this reader contains another entry, blocking if
necessary until either the next entry is available or the end of the
stream is reached.hasNext
in interface EntryReader
true
if this reader contains another entry.DecodeException
- If the entry could not be decoded because it was malformed.IOException
- If an unexpected IO error occurred.public Entry readEntry() throws IOException
readEntry
in interface EntryReader
DecodeException
- If the entry could not be decoded because it was malformed.IOException
- If an unexpected IO error occurred while reading the entry.public LdifEntryReader setExcludeAllOperationalAttributes(boolean excludeOperationalAttributes)
false
.excludeOperationalAttributes
- true
if all operational attributes should be excluded,
or false
otherwise.LdifEntryReader
.public LdifEntryReader setExcludeAllUserAttributes(boolean excludeUserAttributes)
false
.excludeUserAttributes
- true
if all user attributes should be excluded, or
false
otherwise.LdifEntryReader
.public LdifEntryReader setExcludeAttribute(AttributeDescription attributeDescription)
attributeDescription
- The name of the attribute to be excluded.LdifEntryReader
.public LdifEntryReader setExcludeBranch(Dn excludeBranch)
excludeBranch
- The distinguished name of the branch to be excluded.LdifEntryReader
.public LdifEntryReader setExcludeFilter(Matcher excludeFilter)
excludeFilter
- The filter matcher.LdifEntryReader
.public LdifEntryReader setIncludeAttribute(AttributeDescription attributeDescription)
attributeDescription
- The name of the attribute to be included.LdifEntryReader
.public LdifEntryReader setIncludeBranch(Dn includeBranch)
includeBranch
- The distinguished name of the branch to be included.LdifEntryReader
.public LdifEntryReader setIncludeFilter(Matcher includeFilter)
includeFilter
- The filter matcher.LdifEntryReader
.public LdifEntryReader setRejectedLdifListener(RejectedLdifListener listener)
By default the RejectedLdifListener.FAIL_FAST
listener is used.
listener
- The rejected record listener.LdifEntryReader
.public LdifEntryReader setSchema(Schema schema)
schema
- The schema which should be used for decoding entries that are
read from LDIF.LdifEntryReader
.public LdifEntryReader setSchemaValidationPolicy(SchemaValidationPolicy policy)
Schema validation is disabled by default.
NOTE: this method copies the provided policy so changes made to it after this method has been called will have no effect.
policy
- The schema validation which should be used when reading LDIF
entry records.LdifEntryReader
.Copyright 2010-2018 ForgeRock AS.