Package org.ldaptive.io
Class LdifReader
java.lang.Object
org.ldaptive.io.LdifReader
- All Implemented Interfaces:
SearchResultReader
Reads an LDIF from a
Reader and returns a SearchResponse. This implementation only supports entry
records. It does not support change records or include statements.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate LdapAttributeparseAttribute(String line) Parses the supplied line and returns an attribute with a single value found in the line.private LdapEntryparseEntry(List<String> section) Parses the supplied array of LDIF lines and returns an LDAP entry.private SearchResultReferenceparseReference(List<String> section) Parses the supplied array of LDIF lines and returns a search reference.read()Reads LDIF data from the reader and returns a search result.readSection(BufferedReader reader) Reads the supplied reader line-by-line until the reader is empty or a empty line is encountered.
-
Field Details
-
READ_AHEAD_LIMIT
private static final int READ_AHEAD_LIMITMark read back buffer size.- See Also:
-
logger
Logger for this class. -
ldifReader
Reader to read from.
-
-
Constructor Details
-
LdifReader
Creates a new ldif reader.- Parameters:
reader- to read LDIF from
-
-
Method Details
-
read
Reads LDIF data from the reader and returns a search result.- Specified by:
readin interfaceSearchResultReader- Returns:
- search result derived from the LDIF
- Throws:
IOException- if an error occurs using the reader
-
readSection
Reads the supplied reader line-by-line until the reader is empty or a empty line is encountered. Lines containing comments are ignored.- Parameters:
reader- to read- Returns:
- list of a lines in the section
- Throws:
IOException- if an error occurs reading
-
parseEntry
Parses the supplied array of LDIF lines and returns an LDAP entry.- Parameters:
section- of LDIF lines- Returns:
- ldap entry
- Throws:
IOException- if an errors occurs reading a URI in the LDIF
-
parseAttribute
Parses the supplied line and returns an attribute with a single value found in the line.- Parameters:
line- to parse- Returns:
- ldap attribute
- Throws:
IOException- if an errors occurs reading a URI in the LDIF
-
parseReference
Parses the supplied array of LDIF lines and returns a search reference.- Parameters:
section- of LDIF lines- Returns:
- search reference
-