Class CSSDataURLHelper

java.lang.Object
com.helger.css.utils.CSSDataURLHelper

@Immutable public final class CSSDataURLHelper extends Object
Provides data URL handling sanity methods (RFC 2397).
Author:
Philip Helger
  • Field Details

    • DEFAULT_CHARSET

      public static final Charset DEFAULT_CHARSET
      The default charset to be used for Data URLs: US-ASCII
    • DEFAULT_MIME_TYPE

      public static final com.helger.commons.mime.IMimeType DEFAULT_MIME_TYPE
      The default MIME type for Data URLs: text/plain;charset=US-ASCII
    • PREFIX_DATA_URL

      public static final String PREFIX_DATA_URL
      The default prefix for data URLs
      See Also:
    • BASE64_MARKER

      public static final String BASE64_MARKER
      The marker for Base64 encoding
      See Also:
    • SEPARATOR_CONTENT

      public static final char SEPARATOR_CONTENT
      The separator that starts the content
      See Also:
    • MIME_QUOTING

      public static final com.helger.commons.mime.EMimeQuoting MIME_QUOTING
      Data URLs should use the URL code to quote values!
  • Method Details

    • isDataURL

      public static boolean isDataURL(@Nullable String sURL)
      Check if the passed URL is a data URL. It is checked, whether the passed URL starts with "data:" (after trimming, case insensitive).
      Parameters:
      sURL - The URL to check. May be null.
      Returns:
      true if the passed URL is a data URL, false if not.
    • parseDataURL

      @Nullable public static CSSDataURL parseDataURL(@Nullable String sDataURL)
      Parse a data URL into this type.
       Syntax
         dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
         mediatype  := [ type "/" subtype ] *( ";" parameter )
         data       := *urlchar
         parameter  := attribute "=" value
       
      Parameters:
      sDataURL - The data URL to be parsed. May be null.
      Returns:
      null if parsing failed