Class RFC5987Codec

java.lang.Object
com.helger.base.codec.impl.RFC5987Codec
All Implemented Interfaces:
IEncoder<String,String>

public class RFC5987Codec extends Object implements IEncoder<String,String>
RFC 5987 Encoder. Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters
Author:
Philip Helger
  • Field Details

  • Constructor Details

    • RFC5987Codec

      public RFC5987Codec()
      Default constructor using UTF-8 charset.
    • RFC5987Codec

      public RFC5987Codec(@NonNull Charset aCharset)
      Constructor using a specific charset.
      Parameters:
      aCharset - The charset to use for encoding. May not be null.
  • Method Details

    • getRFC5987Encoded

      public static @NonNull String getRFC5987Encoded(@NonNull String sSrc, @NonNull Charset aCharset)
      Encode the passed string using RFC 5987 encoding with the specified charset.
      Parameters:
      sSrc - The source string to encode. May not be null.
      aCharset - The charset to use for encoding. May not be null.
      Returns:
      The encoded string. Never null.
    • getRFC5987EncodedUTF8

      public static @NonNull String getRFC5987EncodedUTF8(@NonNull String sSrc)
      Encode the passed string using RFC 5987 encoding with UTF-8 charset.
      Parameters:
      sSrc - The source string to encode. May not be null.
      Returns:
      The encoded string. Never null.
    • getEncoded

      public @Nullable String getEncoded(@Nullable String sSrc)
      Encode the passed string using RFC 5987 encoding with the charset specified in the constructor.
      Specified by:
      getEncoded in interface IEncoder<String,String>
      Parameters:
      sSrc - The source string to encode. May be null.
      Returns:
      The encoded string or null if the input was null.