ezvcard.util
Class DataUri

java.lang.Object
  extended by ezvcard.util.DataUri

public class DataUri
extends Object

Represents a data URI.

Example: data:image/jpeg;base64,<base64-encoded text>

Author:
Michael Angstadt

Field Summary
protected  String contentType
           
protected  byte[] data
           
protected static Pattern regex
           
 
Constructor Summary
DataUri(String uri)
           
DataUri(String contentType, byte[] data)
           
 
Method Summary
 String getContentType()
          Sets the content type.
 byte[] getData()
          Gets the binary data.
 void setContentType(String contentType)
          Sets the content type.
 void setData(byte[] data)
          Sets the binary data.
 String toString()
           
 URI toUri()
          Creates a URI object from this data URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

regex

protected static final Pattern regex

data

protected byte[] data

contentType

protected String contentType
Constructor Detail

DataUri

public DataUri(String contentType,
               byte[] data)
Parameters:
data - the binary data
contentType - the content type (e.g. "image/jpeg")

DataUri

public DataUri(String uri)
Parameters:
uri - the data URI to parse
Throws:
IllegalArgumentException - if the given URI is not a valid data URI
Method Detail

getData

public byte[] getData()
Gets the binary data.

Returns:
the binary data or null if not set

setData

public void setData(byte[] data)
Sets the binary data.

Parameters:
data - the binary data

getContentType

public String getContentType()
Sets the content type.

Returns:
the content type (e.g. "image/jpeg")

setContentType

public void setContentType(String contentType)
Sets the content type.

Parameters:
contentType - the content type (e.g. "image/jpeg")

toUri

public URI toUri()
Creates a URI object from this data URI.

Returns:
the URI object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013. All Rights Reserved.