Package com.helger.css.utils
Class CSSDataURLHelper
java.lang.Object
com.helger.css.utils.CSSDataURLHelper
Provides data URL handling sanity methods (RFC 2397).
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe marker for Base64 encodingstatic final CharsetThe default charset to be used for Data URLs: US-ASCIIstatic final com.helger.commons.mime.IMimeTypeThe default MIME type for Data URLs: text/plain;charset=US-ASCIIstatic final com.helger.commons.mime.EMimeQuotingData URLs should use the URL code to quote values!static final StringThe default prefix for data URLsstatic final charThe separator that starts the content -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCheck if the passed URL is a data URL.static CSSDataURLparseDataURL(String sDataURL) Parse a data URL into this type.
-
Field Details
-
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_TYPEThe default MIME type for Data URLs: text/plain;charset=US-ASCII -
PREFIX_DATA_URL
The default prefix for data URLs- See Also:
-
BASE64_MARKER
The marker for Base64 encoding- See Also:
-
SEPARATOR_CONTENT
public static final char SEPARATOR_CONTENTThe separator that starts the content- See Also:
-
MIME_QUOTING
public static final com.helger.commons.mime.EMimeQuoting MIME_QUOTINGData URLs should use the URL code to quote values!
-
-
Method Details
-
isDataURL
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:
trueif the passed URL is a data URL,falseif not.
-
parseDataURL
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:
nullif parsing failed
-