| 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(Charset 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(Charset charset)
charset - only applicable if the data URI's value is text. Defines
what character set to use when encoding text value in base64. Setting
this to "null" will insert the text in the data URI as-is without
base64-encoding it.Copyright © 2012–2026 Michael Angstadt. All rights reserved.