Package com.helger.css.utils
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 Summary
Fields Modifier and Type Field Description static String
BASE64_MARKER
The marker for Base64 encodingstatic Charset
DEFAULT_CHARSET
The default charset to be used for Data URLs: US-ASCIIstatic com.helger.commons.mime.IMimeType
DEFAULT_MIME_TYPE
The default MIME type for Data URLs: text/plain;charset=US-ASCIIstatic com.helger.commons.mime.EMimeQuoting
MIME_QUOTING
Data URLs should use the URL code to quote values!static String
PREFIX_DATA_URL
The default prefix for data URLsstatic char
SEPARATOR_CONTENT
The separator that starts the content
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isDataURL(String sURL)
Check if the passed URL is a data URL.static CSSDataURL
parseDataURL(String sDataURL)
Parse a data URL into this type.
-
-
-
Field Detail
-
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:
- Constant Field Values
-
BASE64_MARKER
public static final String BASE64_MARKER
The marker for Base64 encoding- See Also:
- Constant Field Values
-
SEPARATOR_CONTENT
public static final char SEPARATOR_CONTENT
The separator that starts the content- See Also:
- Constant Field Values
-
MIME_QUOTING
public static final com.helger.commons.mime.EMimeQuoting MIME_QUOTING
Data URLs should use the URL code to quote values!
-
-
Method Detail
-
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 benull
.- 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 benull
.- Returns:
null
if parsing failed
-
-