Class DNEscapingStrategy

java.lang.Object
com.unboundid.ldap.sdk.DNEscapingStrategy
All Implemented Interfaces:
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 Details

    • 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 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 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.
  • Method Details

    • 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:
      true if ASCII control characters should be escaped, or false if not.
    • escapeDisplayableNonASCIICharacters

      Indicates whether displayable non-ASCII characters (as determined by the 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.
      Returns:
      true if displayable non-ASCII characters should be escaped, or false if not.
    • escapeNonDisplayableNonASCIICharacters

      Indicates whether non-displayable non-ASCII characters (as determined by the 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.
      Returns:
      true if non-displayable non-ASCII characters should be escaped, or false if not.
    • escapeNonUTF8Data

      public 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.
      Returns:
      true if bytes with the most significant bit set in non-UTF-8 data should be escaped, or false if 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 be null.
      buffer - The buffer to which the escaped value should be appended. It must not be null.
    • escape

      public void escape(@NotNull 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 be null.
      buffer - The buffer to which the escaped value should be appended. It must not be null.
    • 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 be null.
      buffer - The buffer to which the escaped value should be appended. It must not be null.
    • toString

      Retrieves a string representation of this base64 encoding strategy.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this base64 encoding strategy.
    • toString

      public void toString(@NotNull StringBuilder buffer)
      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.