public class Logo extends ImageProperty
Defines a company logo.
Code sample (creating)
VCard vcard = new VCard(); //URL Logo logo = new Logo("http://www.ourcompany.com/our-logo.png", ImageType.PNG); vcard.addLogo(logo); //binary data byte data[] = ... logo = new Logo(data, ImageType.PNG); vcard.addLogo(logo);
Code sample (retrieving)
VCard vcard = ... for (Logo logo : vcard.getLogos()) { ImageType contentType = logo.getContentType(); //e.g. "image/png" String url = logo.getUrl(); if (url != null) { //property value is a URL continue; } byte[] data = logo.getData(); if (data != null) { //property value is binary data continue; } }
Property name: LOGO
Supported versions: 2.1, 3.0, 4.0
contentType, data, url
group, parameters
Constructor and Description |
---|
Logo(byte[] data,
ImageType type)
Creates a logo property.
|
Logo(InputStream in,
ImageType type)
Creates a logo property.
|
Logo(Logo original)
Copy constructor.
|
Logo(Path file,
ImageType type)
Creates a logo property.
|
Logo(String url,
ImageType type)
Creates a logo property.
|
Modifier and Type | Method and Description |
---|---|
Logo |
copy()
Creates a copy of this property object.
|
String |
getLanguage()
Gets the language that the property value is written in.
|
void |
setLanguage(String language)
Sets the language that the property value is written in.
|
_validate, equals, getAltId, getContentType, getData, getPids, getPref, getType, getUrl, hashCode, setAltId, setContentType, setData, setPref, setType, setUrl, toStringValues
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, isSupportedBy, removeParameter, setGroup, setParameter, setParameters, toString, validate
public Logo(String url, ImageType type)
url
- the URL to the logotype
- the content type (e.g. PNG)public Logo(byte[] data, ImageType type)
data
- the binary data of the logotype
- the content type (e.g. PNG)public Logo(InputStream in, ImageType type) throws IOException
in
- an input stream to the binary data (will be closed)type
- the content type (e.g. PNG)IOException
- if there's a problem reading from the input streampublic Logo(Path file, ImageType type) throws IOException
file
- the image filetype
- the content type (e.g. PNG)IOException
- if there's a problem reading from the filepublic String getLanguage()
VCardProperty
public void setLanguage(String language)
VCardProperty
language
- the language or null to removepublic Logo copy()
VCardProperty
Creates a copy of this property object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
VCardProperty.VCardProperty(VCardProperty)
super constructor to ensure that
the group name and parameters are also copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException
will be thrown when an attempt is
made to copy the property (such as in the VCard
class's copy constructor
).
copy
in class VCardProperty
Copyright © 2012–2023 Michael Angstadt. All rights reserved.