Package org.ldaptive
Class LdapAttribute.AttributeValue
java.lang.Object
org.ldaptive.LdapAttribute.AttributeValue
- Enclosing class:
- LdapAttribute
Container for an attribute value. Supports helpers methods related to byte arrays and the notion of `binary`
attribute values which are base64 encoded.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final inthash code seed.private final byte[]attribute value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]base64Decode(String string, boolean throwOnError) Base64 decodes the supplied string.(package private) static LdapAttribute.AttributeValuecopy(LdapAttribute.AttributeValue value) Creates a copy of the supplied attribute value.boolean(package private) booleanequalsValue(byte[] bytes) Returns whether the supplied byte array equals this attribute value.(package private) booleanequalsValue(String string, boolean base64) Returns whether the supplied string equals this attribute value.(package private) static LdapAttribute.AttributeValuefromString(String string, boolean base64) Creates a new attribute value from the supplied string.(package private) StringgetStringValue(boolean base64) Returns the value of this attribute value as a string.(package private) byte[]getValue(boolean copy) Returns the value of this attribute value.inthashCode()
-
Field Details
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
value
private final byte[] valueattribute value.
-
-
Constructor Details
-
AttributeValue
AttributeValue(byte[] bytes, boolean copy) Creates a new attribute value.- Parameters:
bytes- byte array valuecopy- whether to copy the supplied bytes
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
getValue
byte[] getValue(boolean copy) Returns the value of this attribute value.- Parameters:
copy- whether to create a copy of the underlying value- Returns:
- value
-
getStringValue
Returns the value of this attribute value as a string.- Parameters:
base64- whether value should be a base64 encoded string- Returns:
- string value
-
equalsValue
boolean equalsValue(byte[] bytes) Returns whether the supplied byte array equals this attribute value.- Parameters:
bytes- to compare- Returns:
- whether the supplied byte array equals this attribute value
-
equalsValue
Returns whether the supplied string equals this attribute value.- Parameters:
string- to comparebase64- whether the string is base64 encoded- Returns:
- whether the supplied string equals this attribute value
-
fromString
Creates a new attribute value from the supplied string.- Parameters:
string- to create attribute value frombase64- whether string should be base64 decoded- Returns:
- new attribute value
-
copy
Creates a copy of the supplied attribute value.- Parameters:
value- to create copy of- Returns:
- new attribute value
-
base64Decode
Base64 decodes the supplied string.- Parameters:
string- to decodethrowOnError- whether throw if string cannot be decoded- Returns:
- base64 decoded bytes or null if throwOnError if false and string cannot be decoded
-