|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.ldap.LDAPAttribute
The name and values of one attribute of a directory entry.
LDAPAttribute objects are used when searching for, adding,
modifying, and deleting attributes from the directory.
LDAPAttributes are often used in conjunction with an
LDAPAttributeSet
when retrieving or adding multiple
attributes to an entry.
Sample Code: AddEntry.java
LDAPEntry
,
LDAPAttributeSet
,
LDAPModification
,
Serialized FormConstructor Summary | |
LDAPAttribute(LDAPAttribute attr)
Constructs an attribute with copies of all values of the input attribute. |
|
LDAPAttribute(java.lang.String attrName)
Constructs an attribute with no values. |
|
LDAPAttribute(java.lang.String attrName,
byte[] attrBytes)
Constructs an attribute with a byte-formatted value. |
|
LDAPAttribute(java.lang.String attrName,
java.lang.String attrString)
Constructs an attribute with a single string value. |
|
LDAPAttribute(java.lang.String attrName,
java.lang.String[] attrStrings)
Constructs an attribute with an array of string values. |
Method Summary | |
void |
addBase64Value(char[] attrChars)
Adds a base64 encoded value to the attribute. |
void |
addBase64Value(java.lang.String attrString)
Adds a base64 encoded value to the attribute. |
void |
addBase64Value(java.lang.StringBuffer attrString,
int start,
int end)
Adds a base64 encoded value to the attribute. |
void |
addURLValue(java.lang.String url)
Adds a URL, indicating a file or other resource that contains the value of the attribute. |
void |
addURLValue(java.net.URL url)
Adds a URL, indicating a file or other resource that contains the value of the attribute. |
void |
addValue(byte[] attrBytes)
Adds a byte-formatted value to the attribute. |
void |
addValue(java.lang.String attrString)
Adds a string value to the attribute. |
java.lang.Object |
clone()
Returns a clone of this LDAPAttribute. |
int |
compareTo(java.lang.Object attribute)
Compares this object with the specified object for order. |
java.lang.String |
getBaseName()
Returns the base name of the attribute. |
static java.lang.String |
getBaseName(java.lang.String attrName)
Returns the base name of the specified attribute name. |
byte[] |
getByteValue()
Returns the the first value of the attribute as a byte array. |
byte[][] |
getByteValueArray()
Returns the values of the attribute as an array of bytes. |
java.util.Enumeration |
getByteValues()
Returns an enumerator for the values of the attribute in byte format. |
java.lang.String |
getLangSubtype()
Returns the language subtype of the attribute, if any. |
java.lang.String |
getName()
Returns the name of the attribute. |
java.lang.String |
getStringValue()
Returns the the first value of the attribute as a String . |
java.lang.String[] |
getStringValueArray()
Returns the values of the attribute as an array of strings. |
java.util.Enumeration |
getStringValues()
Returns an enumerator for the string values of an attribute. |
java.lang.String[] |
getSubtypes()
Extracts the subtypes from the attribute name. |
static java.lang.String[] |
getSubtypes(java.lang.String attrName)
Extracts the subtypes from the specified attribute name. |
boolean |
hasSubtype(java.lang.String subtype)
Reports if the attribute name contains the specified subtype. |
boolean |
hasSubtypes(java.lang.String[] subtypes)
Reports if the attribute name contains all the specified subtypes. |
static java.lang.Object |
readDSML(java.io.InputStream input)
This method is used to deserialize the DSML encoded representation of this class. |
void |
removeValue(byte[] attrBytes)
Removes a byte-formatted value from the attribute. |
void |
removeValue(java.lang.String attrString)
Removes a string value from the attribute. |
protected void |
setValue(java.lang.String value)
Replaces all values with the specified value. |
int |
size()
Returns the number of values in the attribute. |
java.lang.String |
toString()
Returns a string representation of this LDAPAttribute |
void |
writeDSML(java.io.OutputStream oout)
This method does DSML serialization of the instance. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LDAPAttribute(LDAPAttribute attr)
attr
- An LDAPAttribute to use as a template.
java.lang.IllegalArgumentException
- if attr is nullpublic LDAPAttribute(java.lang.String attrName)
attrName
- Name of the attribute.
java.lang.IllegalArgumentException
- if attrName is nullpublic LDAPAttribute(java.lang.String attrName, byte[] attrBytes)
attrName
- Name of the attribute.attrBytes
- Value of the attribute as raw bytes.
Note: If attrBytes represents a string it should be UTF-8 encoded.
java.lang.IllegalArgumentException
- if attrName or attrBytes is nullpublic LDAPAttribute(java.lang.String attrName, java.lang.String attrString)
attrName
- Name of the attribute.attrString
- Value of the attribute as a string.
java.lang.IllegalArgumentException
- if attrName or attrString is nullpublic LDAPAttribute(java.lang.String attrName, java.lang.String[] attrStrings)
attrName
- Name of the attribute.attrStrings
- Array of values as strings.
java.lang.IllegalArgumentException
- if attrName, attrStrings, or a member
of attrStrings is nullMethod Detail |
public java.lang.Object clone()
public void addValue(java.lang.String attrString)
attrString
- Value of the attribute as a String.
java.lang.IllegalArgumentException
- if attrString is nullpublic void addValue(byte[] attrBytes)
attrBytes
- Value of the attribute as raw bytes.
Note: If attrBytes represents a string it should be UTF-8 encoded.
java.lang.IllegalArgumentException
- if attrBytes is nullpublic void addBase64Value(java.lang.String attrString)
attrString
- The base64 value of the attribute as a String.
java.lang.IllegalArgumentException
- if attrString is nullpublic void addBase64Value(java.lang.StringBuffer attrString, int start, int end)
attrString
- The base64 value of the attribute as a StringBuffer.start
- The start index of base64 encoded part, inclusive.end
- The end index of base encoded part, exclusive.
java.lang.IllegalArgumentException
- if attrString is nullpublic void addBase64Value(char[] attrChars)
attrChars
- The base64 value of the attribute as an array of
characters.
java.lang.IllegalArgumentException
- if attrString is nullpublic void addURLValue(java.lang.String url) throws java.net.MalformedURLException, java.io.IOException
url
- String value of a URL pointing to the resource containing
the value of the attribute.
java.lang.IllegalArgumentException
- if url is null
java.net.MalformedURLException
java.io.IOException
public void addURLValue(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException
url
- A URL class pointing to the resource containing the value
of the attribute.
java.lang.IllegalArgumentException
- if url is null
java.net.MalformedURLException
java.io.IOException
public java.util.Enumeration getByteValues()
Note: All string values will be UTF-8 encoded. To decode use the String constructor. Example: new String( byteArray, "UTF-8" );
public java.util.Enumeration getStringValues()
public byte[][] getByteValueArray()
public java.lang.String[] getStringValueArray()
public java.lang.String getStringValue()
String
.
String
value of the attribute's
value. If the value wasn't a UTF-8 encoded String
to begin with the value of the returned String
is
non deterministic.
If this
attribute has more than one value the
first value is converted to a UTF-8 encoded String
and returned. It should be noted, that the directory may
return attribute values in any order, so that the first
value may vary from one call to another.
If the attribute has no values null
is returned
public byte[] getByteValue()
this
attribute or
null
if this
attribute doesn't have a value.
If the attribute has no values null
is returned
public java.lang.String getLangSubtype()
For example, if the attribute name is cn;lang-ja;phonetic, this method returns the string, lang-ja.
public java.lang.String getBaseName()
For example, if the attribute name is cn;lang-ja;phonetic, this method returns cn.
public static java.lang.String getBaseName(java.lang.String attrName)
For example, if the attribute name is cn;lang-ja;phonetic, this method returns cn.
attrName
- Name of the attribute from which to extract the
base name.
java.lang.IllegalArgumentException
- if attrName is nullpublic java.lang.String getName()
public java.lang.String[] getSubtypes()
For example, if the attribute name is cn;lang-ja;phonetic, this method returns an array containing lang-ja and phonetic.
public static java.lang.String[] getSubtypes(java.lang.String attrName)
For example, if the attribute name is cn;lang-ja;phonetic, this method returns an array containing lang-ja and phonetic.
attrName
- Name of the attribute from which to extract
the subtypes.
java.lang.IllegalArgumentException
- if attrName is nullpublic boolean hasSubtype(java.lang.String subtype)
For example, if you check for the subtype lang-en and the attribute name is cn;lang-en, this method returns true.
subtype
- The single subtype to check for.
java.lang.IllegalArgumentException
- if subtype is nullpublic boolean hasSubtypes(java.lang.String[] subtypes)
For example, if you check for the subtypes lang-en and phonetic and if the attribute name is cn;lang-en;phonetic, this method returns true. If the attribute name is cn;phonetic or cn;lang-en, this method returns false.
subtypes
- An array of subtypes to check for.
java.lang.IllegalArgumentException
- if subtypes is null or if array member
is null.public void removeValue(java.lang.String attrString)
attrString
- Value of the attribute as a string.
Note: Removing a value which is not present in the attribute has no effect.
java.lang.IllegalArgumentException
- if attrString is nullpublic void removeValue(byte[] attrBytes)
attrBytes
- Value of the attribute as raw bytes.
Note: If attrBytes represents a string it should be UTF-8 encoded.
Example: String.getBytes("UTF-8");
Note: Removing a value which is not present in the attribute has no effect.
java.lang.IllegalArgumentException
- if attrBytes is nullpublic int size()
public int compareTo(java.lang.Object attribute)
Ordering is determined by comparing attribute names (see
getName()
) using the method compareTo() of the String class.
compareTo
in interface java.lang.Comparable
attribute
- The LDAPAttribute to be compared to this object.
protected void setValue(java.lang.String value)
public java.lang.String toString()
public void writeDSML(java.io.OutputStream oout) throws java.io.IOException
oout
- Outputstream where the serialzed data has to be written
java.io.IOException
- if write fails on OutputStreampublic static java.lang.Object readDSML(java.io.InputStream input) throws java.io.IOException
input
- InputStream for the DSML formatted data.
java.io.IOException
- when serialization fails.
|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |