public class Photo extends ImageProperty
Defines a photo, such as the person's portrait.
Code sample (creating)
VCard vcard = new VCard();
//URL
Photo photo = new Photo("http://www.mywebsite.com/my-photo.jpg", ImageType.JPEG);
vcard.addPhoto(photo);
//binary data
byte data[] = ...
photo = new Photo(data, ImageType.JPEG);
vcard.addPhoto(photo);
Code sample (retrieving)
VCard vcard = ...
for (Photo photo : vcard.getPhotos()){
PhotoType contentType = photo.getContentType(); //e.g. "image/jpeg"
String url = photo.getUrl();
if (url != null){
//property value is a URL
continue;
}
byte[] data = photo.getData();
if (data != null){
//property value is binary data
continue;
}
}
Property name: PHOTO
Supported versions: 2.1, 3.0, 4.0
contentType, data, urlgroup, parameters| Constructor and Description |
|---|
Photo(byte[] data,
ImageType type)
Creates a photo property.
|
Photo(java.io.File file,
ImageType type)
Creates a photo property.
|
Photo(java.io.InputStream in,
ImageType type)
Creates a photo property.
|
Photo(java.lang.String url,
ImageType type)
Creates a photo property.
|
_validate, addPid, getAltId, getContentType, getData, getPids, getPref, getType, getUrl, removePids, setAltId, setContentType, setData, setPref, setType, setUrl_supportedVersions, addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validatepublic Photo(java.lang.String url,
ImageType type)
url - the URL to the phototype - the content type (e.g. JPEG)public Photo(byte[] data,
ImageType type)
data - the binary data of the phototype - the content type (e.g. JPEG)public Photo(java.io.InputStream in,
ImageType type)
throws java.io.IOException
in - an input stream to the binary data (will be closed)type - the content type (e.g. JPEG)java.io.IOException - if there's a problem reading from the input streampublic Photo(java.io.File file,
ImageType type)
throws java.io.IOException
file - the image filetype - the content type (e.g. JPEG)java.io.IOException - if there's a problem reading from the fileThis software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.