Package com.unboundid.ldap.sdk
Class DNEscapingStrategy
java.lang.Object
com.unboundid.ldap.sdk.DNEscapingStrategy
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class DNEscapingStrategy
extends Object
implements Serializable
This class defines a set of properties that can be used to indicate which
types of optional escaping should be performed by the LDAP SDK when
constructing the string representation of DNs and RDNs.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DNEscapingStrategyA DN escaping strategy that represents a default, user-friendly configuration.static final DNEscapingStrategyA base64-encoding strategy that indicates that the LDAP SDK should perform the maximum amount of DN escaping that is considered reasonable.static final DNEscapingStrategyA DN escaping strategy that indicates that the LDAP SDK should only perform required escaping and should not perform any optional escaping. -
Constructor Summary
ConstructorsConstructorDescriptionDNEscapingStrategy(boolean escapeASCIIControlCharacters, boolean escapeDisplayableNonASCIICharacters, boolean escapeNonDisplayableNonASCIICharacters, boolean escapeNonUTF8Data) Creates a new DN escaping strategy with the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidescape(byte[] value, ByteStringBuffer buffer) Appends an appropriately escaped representation of the provided value to the given buffer.voidescape(ByteString value, ByteStringBuffer buffer) Appends an appropriately escaped representation of the provided value to the given buffer.voidescape(String value, ByteStringBuffer buffer) Appends an appropriately escaped representation of the provided value to the given buffer.booleanIndicates whether ASCII control characters should be escaped.booleanIndicates whether displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.booleanIndicates whether non-displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.booleanIndicates whether bytes with the most significant bit set in non-UTF-8 data (as determined by theStaticUtils.isValidUTF8(byte[])method) should be escaped.toString()Retrieves a string representation of this base64 encoding strategy.voidtoString(StringBuilder buffer) Appends a string representation of this base64 encoding strategy to the provided buffer.
-
Field Details
-
DEFAULT
A DN escaping strategy that represents a default, user-friendly configuration. This includes:- ASCII control characters will be escaped.
- Displayable non-ASCII characters will not be escaped.
- Non-displayable non-ASCII characters will be escaped.
- In non-UTF-8 data, all bytes with the most significant bit set will be escaped.
-
MINIMAL
A DN escaping strategy that indicates that the LDAP SDK should only perform required escaping and should not perform any optional escaping. -
MAXIMAL
A base64-encoding strategy that indicates that the LDAP SDK should perform the maximum amount of DN escaping that is considered reasonable. All ASCII control characters, all non-ASCII characters and non-UTF-8 bytes will be escaped.
-
-
Constructor Details
-
DNEscapingStrategy
public DNEscapingStrategy(boolean escapeASCIIControlCharacters, boolean escapeDisplayableNonASCIICharacters, boolean escapeNonDisplayableNonASCIICharacters, boolean escapeNonUTF8Data) Creates a new DN escaping strategy with the specified settings.- Parameters:
escapeASCIIControlCharacters- Indicates whether ASCII control characters (characters whose Unicode code point is less than or equal to 0x1F, or is equal to 0x7F) should be escaped. Note that the ASCII NULL control character (0x00) will always be escaped.escapeDisplayableNonASCIICharacters- Indicates whether non-ASCII characters (characters whose Unicode code point is greater than 0x7F) that are believed to be displayable (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.escapeNonDisplayableNonASCIICharacters- Indicates whether non-ASCII characters (characters whose Unicode code point is greater than 0x7F) that are not believed to be displayable (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.escapeNonUTF8Data- Indicates whether bytes with the most significant bit set in non-UTF-8 data should be escaped. Note that if a value does not represent a valid UTF-8 string, then theescapeDisplayableNonASCIICharactersandescapeNonDisplayableNonASCIICharactersarguments will not be used.
-
-
Method Details
-
escapeASCIIControlCharacters
Indicates whether ASCII control characters should be escaped. Note that the ASCII NULL control character (0x00) will always be escaped.- Returns:
trueif ASCII control characters should be escaped, orfalseif not.
-
escapeDisplayableNonASCIICharacters
Indicates whether displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped. Note that this only applies to values that represent valid UTF-8 strings. Values that are not valid UTF-8 strings will use the setting represented by theescapeNonUTF8Datamethod.- Returns:
trueif displayable non-ASCII characters should be escaped, orfalseif not.
-
escapeNonDisplayableNonASCIICharacters
Indicates whether non-displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped. Note that this only applies to values that represent valid UTF-8 strings. Values that are not valid UTF-8 strings will use the setting represented by theescapeNonUTF8Datamethod.- Returns:
trueif non-displayable non-ASCII characters should be escaped, orfalseif not.
-
escapeNonUTF8Data
Indicates whether bytes with the most significant bit set in non-UTF-8 data (as determined by theStaticUtils.isValidUTF8(byte[])method) should be escaped.- Returns:
trueif bytes with the most significant bit set in non-UTF-8 data should be escaped, orfalseif not.
-
escape
Appends an appropriately escaped representation of the provided value to the given buffer.- Parameters:
value- The value to be appended. It must not benull.buffer- The buffer to which the escaped value should be appended. It must not benull.
-
escape
Appends an appropriately escaped representation of the provided value to the given buffer.- Parameters:
value- The value to be appended. It must not benull.buffer- The buffer to which the escaped value should be appended. It must not benull.
-
escape
Appends an appropriately escaped representation of the provided value to the given buffer.- Parameters:
value- The value to be appended. It must not benull.buffer- The buffer to which the escaped value should be appended. It must not benull.
-
toString
Retrieves a string representation of this base64 encoding strategy. -
toString
Appends a string representation of this base64 encoding strategy to the provided buffer.- Parameters:
buffer- The buffer to which the string representation should be appended.
-