Interface PercentEncoded<SELF extends PercentEncoded<SELF>>

All Superinterfaces:
Normalisable<SELF>, org.wiremock.stringparser.ParsedString
All Known Subinterfaces:
Fragment, Host, Password, Path, Query, QueryParamKey, QueryParamValue, Segment, UserInfo, Username

public interface PercentEncoded<SELF extends PercentEncoded<SELF>> extends Normalisable<SELF>, org.wiremock.stringparser.ParsedString
Represents a string that may contain percent-encoded characters as defined in RFC 3986 Section 2.1.

Percent-encoding is a mechanism to represent characters that are not allowed or have special meaning in URIs. Characters are encoded as a percent sign (%) followed by two hexadecimal digits representing the byte value.

Implementations must provide a Object.toString() method that returns the percent-encoded string representation.

Implementations must be immutable and thread-safe.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Decodes all percent-encoded sequences in this string.
    default boolean
    Returns true if this percent-encoded string is empty.
    default int
    Returns the length of this percent-encoded string.

    Methods inherited from interface org.wiremock.url.Normalisable

    isNormalForm, normalise

    Methods inherited from interface org.wiremock.stringparser.ParsedString

    toString
  • Method Details

    • decode

      default String decode()
      Decodes all percent-encoded sequences in this string.

      Sequences like %20 are decoded to their corresponding characters using UTF-8 encoding.

      Returns:
      the decoded string
    • length

      default int length()
      Returns the length of this percent-encoded string.
      Returns:
      the length of the string
    • isEmpty

      default boolean isEmpty()
      Returns true if this percent-encoded string is empty.
      Returns:
      true if the string has zero length