@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class DNEscapingStrategy extends java.lang.Object implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static DNEscapingStrategy |
DEFAULT
A DN escaping strategy that represents a default, user-friendly
configuration.
|
static DNEscapingStrategy |
MAXIMAL
A base64-encoding strategy that indicates that the LDAP SDK should
perform the maximum amount of DN escaping that is considered reasonable.
|
static DNEscapingStrategy |
MINIMAL
A DN escaping strategy that indicates that the LDAP SDK should only perform
required escaping and should not perform any optional escaping.
|
Constructor and Description |
---|
DNEscapingStrategy(boolean escapeASCIIControlCharacters,
boolean escapeDisplayableNonASCIICharacters,
boolean escapeNonDisplayableNonASCIICharacters,
boolean escapeNonUTF8Data)
Creates a new DN escaping strategy with the specified settings.
|
Modifier and Type | Method and Description |
---|---|
void |
escape(byte[] value,
ByteStringBuffer buffer)
Appends an appropriately escaped representation of the provided value to
the given buffer.
|
void |
escape(ByteString value,
ByteStringBuffer buffer)
Appends an appropriately escaped representation of the provided value to
the given buffer.
|
void |
escape(java.lang.String value,
ByteStringBuffer buffer)
Appends an appropriately escaped representation of the provided value to
the given buffer.
|
boolean |
escapeASCIIControlCharacters()
Indicates whether ASCII control characters should be escaped.
|
boolean |
escapeDisplayableNonASCIICharacters()
Indicates whether displayable non-ASCII characters (as determined by the
StaticUtils.isLikelyDisplayableCharacter(int) method) should be escaped. |
boolean |
escapeNonDisplayableNonASCIICharacters()
Indicates whether non-displayable non-ASCII characters (as determined by
the
StaticUtils.isLikelyDisplayableCharacter(int) method) should be
escaped. |
boolean |
escapeNonUTF8Data()
Indicates whether bytes with the most significant bit set in non-UTF-8 data
(as determined by the
StaticUtils.isValidUTF8(byte[]) method) should be
escaped. |
java.lang.String |
toString()
Retrieves a string representation of this base64 encoding strategy.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this base64 encoding strategy to the
provided buffer.
|
@NotNull public static final DNEscapingStrategy DEFAULT
@NotNull public static final DNEscapingStrategy MINIMAL
@NotNull public static final DNEscapingStrategy MAXIMAL
public DNEscapingStrategy(boolean escapeASCIIControlCharacters, boolean escapeDisplayableNonASCIICharacters, boolean escapeNonDisplayableNonASCIICharacters, boolean escapeNonUTF8Data)
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 the
StaticUtils.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 the
StaticUtils.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 the
escapeDisplayableNonASCIICharacters
and
escapeNonDisplayableNonASCIICharacters
arguments will
not be used.public boolean escapeASCIIControlCharacters()
true
if ASCII control characters should be escaped, or
false
if not.public boolean escapeDisplayableNonASCIICharacters()
StaticUtils.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 the escapeNonUTF8Data
method.true
if displayable non-ASCII characters should be
escaped, or false
if not.public boolean escapeNonDisplayableNonASCIICharacters()
StaticUtils.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 the escapeNonUTF8Data
method.true
if non-displayable non-ASCII characters should be
escaped, or false
if not.public boolean escapeNonUTF8Data()
StaticUtils.isValidUTF8(byte[])
method) should be
escaped.true
if bytes with the most significant bit set in
non-UTF-8 data should be escaped, or false
if not.public void escape(@NotNull byte[] value, @NotNull ByteStringBuffer buffer)
value
- The value to be appended. It must not be null
.buffer
- The buffer to which the escaped value should be appended.
It must not be null
.public void escape(@NotNull java.lang.String value, @NotNull ByteStringBuffer buffer)
value
- The value to be appended. It must not be null
.buffer
- The buffer to which the escaped value should be appended.
It must not be null
.public void escape(@NotNull ByteString value, @NotNull ByteStringBuffer buffer)
value
- The value to be appended. It must not be null
.buffer
- The buffer to which the escaped value should be appended.
It must not be null
.@NotNull public java.lang.String toString()
toString
in class java.lang.Object