Constructor and Description |
---|
DataUri(DataUri original)
Copies a data URI.
|
DataUri(String text)
Creates a data URI with a content type of "text/plain".
|
DataUri(String contentType,
byte[] data)
Creates a data URI.
|
DataUri(String contentType,
String text)
Creates a data URI.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getContentType()
Gets the content type.
|
byte[] |
getData()
Gets the binary data.
|
String |
getText()
Gets the text value.
|
int |
hashCode() |
static DataUri |
parse(String uri)
Parses a data URI string.
|
String |
toString()
Creates a data URI string.
|
String |
toString(String charset)
Creates a data URI string.
|
public DataUri(String contentType, byte[] data)
contentType
- the content type of the data (e.g. "image/png")data
- the datapublic DataUri(String contentType, String text)
contentType
- the content type of the text (e.g. "text/html")text
- the textpublic DataUri(String text)
text
- the textpublic static DataUri parse(String uri)
uri
- the URI string (e.g. "data:image/jpeg;base64,[base64 string]")IllegalArgumentException
- if the string is not a valid data URI or
it cannot be parsedpublic byte[] getData()
public String getContentType()
public String getText()
public String toString(String charset)
charset
- only applicable if the data URI's value is text. Defines
the character set to encode the text in, or null not to specify a
character setIllegalArgumentException
- if the given character set is not
supported by this JVMCopyright © 2012–2023 Michael Angstadt. All rights reserved.