public final class DnParser
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
DnParser.OctetStringHandler
Parse handler for decoding octet strings.
|
| Modifier and Type | Field and Description |
|---|---|
private static int |
HEX_RADIX
Hexadecimal radix.
|
private static org.slf4j.Logger |
LOGGER
Logger for this class.
|
| Modifier | Constructor and Description |
|---|---|
private |
DnParser()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<LdapAttribute> |
convertDnToAttributes(java.lang.String dn)
Parses the supplied DN and converts each RDN into a
LdapAttribute. |
protected static byte[] |
decodeHexValue(char[] value)
Decodes the supplied hexadecimal value.
|
protected static java.lang.String |
decodeStringValue(java.lang.String value)
Decodes the supplied string attribute value.
|
static java.lang.String |
getValue(java.lang.String dn,
java.lang.String name)
Returns the RDN value for the attribute type with the supplied name.
|
static java.util.Collection<java.lang.String> |
getValues(java.lang.String dn,
java.lang.String name)
Returns the RDN values for the attribute type with the supplied name.
|
private static int |
readToChar(java.lang.String s,
char[] chars,
int pos)
Reads the supplied string starting at the supplied position until one of the supplied characters is found.
|
static java.lang.String |
substring(java.lang.String dn,
int beginIndex)
Returns a string representation of the supplied DN beginning at the supplied index.
|
static java.lang.String |
substring(java.lang.String dn,
int beginIndex,
int endIndex)
Returns a string representation of the supplied DN beginning at beginIndex (inclusive) and ending at endIndex
(exclusive).
|
private static final org.slf4j.Logger LOGGER
private static final int HEX_RADIX
public static java.util.Collection<java.lang.String> getValues(java.lang.String dn,
java.lang.String name)
dn - to parsename - of the attribute type to return values forpublic static java.lang.String getValue(java.lang.String dn,
java.lang.String name)
dn - to parsename - of the attribute to return value forpublic static java.lang.String substring(java.lang.String dn,
int beginIndex)
dn - to parsebeginIndex - index of first RDN to include in the result in the range [0, N-1] where N is the number of
elements in the DNjava.lang.IndexOutOfBoundsException - if beginIndex is less than 0 or greater than the number of RDNspublic static java.lang.String substring(java.lang.String dn,
int beginIndex,
int endIndex)
dn - to parsebeginIndex - index of first RDN to include in the result in the range [0, N-2] where N is the number of
elements in the DNendIndex - index of last RDN to include in the result in the range [1, N-1] where N is the number of
elements in the RDNjava.lang.IndexOutOfBoundsException - if beginIndex is less than 0, if beginIndex is greater than endIndex, or
endIndex is greater than the number of RDNspublic static java.util.List<LdapAttribute> convertDnToAttributes(java.lang.String dn)
LdapAttribute.dn - to parseprotected static byte[] decodeHexValue(char[] value)
value - hex to decodeprotected static java.lang.String decodeStringValue(java.lang.String value)
value - to decodeprivate static int readToChar(java.lang.String s,
char[] chars,
int pos)
s - to readchars - to matchpos - to start reading at