Package com.unboundid.ldap.sdk
Class DNEscapingStrategy
- java.lang.Object
-
- com.unboundid.ldap.sdk.DNEscapingStrategy
-
- All Implemented Interfaces:
java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class DNEscapingStrategy extends java.lang.Object implements java.io.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DNEscapingStrategyDEFAULTA DN escaping strategy that represents a default, user-friendly configuration.static DNEscapingStrategyMAXIMALA base64-encoding strategy that indicates that the LDAP SDK should perform the maximum amount of DN escaping that is considered reasonable.static DNEscapingStrategyMINIMALA DN escaping strategy that indicates that the LDAP SDK should only perform required escaping and should not perform any optional escaping.
-
Constructor Summary
Constructors Constructor Description DNEscapingStrategy(boolean escapeASCIIControlCharacters, boolean escapeDisplayableNonASCIICharacters, boolean escapeNonDisplayableNonASCIICharacters, boolean escapeNonUTF8Data)Creates a new DN escaping strategy with the specified settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidescape(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(java.lang.String value, ByteStringBuffer buffer)Appends an appropriately escaped representation of the provided value to the given buffer.booleanescapeASCIIControlCharacters()Indicates whether ASCII control characters should be escaped.booleanescapeDisplayableNonASCIICharacters()Indicates whether displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.booleanescapeNonDisplayableNonASCIICharacters()Indicates whether non-displayable non-ASCII characters (as determined by theStaticUtils.isLikelyDisplayableCharacter(int)method) should be escaped.booleanescapeNonUTF8Data()Indicates whether bytes with the most significant bit set in non-UTF-8 data (as determined by theStaticUtils.isValidUTF8(byte[])method) should be escaped.java.lang.StringtoString()Retrieves a string representation of this base64 encoding strategy.voidtoString(java.lang.StringBuilder buffer)Appends a string representation of this base64 encoding strategy to the provided buffer.
-
-
-
Field Detail
-
DEFAULT
@NotNull public static final DNEscapingStrategy 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
@NotNull public static final DNEscapingStrategy MINIMAL
A DN escaping strategy that indicates that the LDAP SDK should only perform required escaping and should not perform any optional escaping.
-
MAXIMAL
@NotNull public static final DNEscapingStrategy 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 Detail
-
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 Detail
-
escapeASCIIControlCharacters
public boolean 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
public boolean 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
public boolean 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
public boolean 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
public void escape(@NotNull byte[] value, @NotNull ByteStringBuffer buffer)
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
public void escape(@NotNull java.lang.String value, @NotNull ByteStringBuffer buffer)
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
public void escape(@NotNull ByteString value, @NotNull ByteStringBuffer buffer)
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
@NotNull public java.lang.String toString()
Retrieves a string representation of this base64 encoding strategy.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this base64 encoding strategy.
-
-