public class Sound extends BinaryProperty<SoundType>
Defines a sound, such as the correct pronunciation of the person's name.
Code sample (creating)
VCard vcard = new VCard(); //URL Sound sound = new Sound("http://www.mywebsite.com/my-name.ogg", SoundType.OGG); vcard.addSound(sound); //binary data byte data[] = ... sound = new Sound(data, SoundType.OGG); vcard.addSound(sound);
Code sample (retrieving)
VCard vcard = ... for (Sound sound : vcard.getSounds()){ SoundType contentType = sound.getContentType(); //e.g. "audio/ogg" String url = sound.getUrl(); if (url != null){ //property value is a URL continue; } byte[] data = sound.getData(); if (data != null){ //property value is binary data continue; } }
Property name: SOUND
Supported versions: 2.1, 3.0, 4.0
contentType, data, url
group, parameters
Constructor and Description |
---|
Sound(byte[] data,
SoundType type)
Creates a sound property.
|
Sound(File file,
SoundType type)
Creates a sound property.
|
Sound(InputStream in,
SoundType type)
Creates a sound property.
|
Sound(String url,
SoundType type)
Creates a sound property.
|
Modifier and Type | Method and Description |
---|---|
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, 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, validate
public Sound(String url, SoundType type)
url
- the URL to the sound filetype
- the content type (e.g. OGG)public Sound(byte[] data, SoundType type)
data
- the binary data of the sound filetype
- the content type (e.g. OGG)public Sound(InputStream in, SoundType type) throws IOException
in
- an input stream to the binary data (will be closed)type
- the content type (e.g. OGG)IOException
- if there's a problem reading from the input streampublic Sound(File file, SoundType type) throws IOException
file
- the sound filetype
- the content type (e.g. OGG)IOException
- if there's a problem reading from the filepublic String getLanguage()
VCardProperty
VCardParameters.getLanguage()
public void setLanguage(String language)
VCardProperty
language
- the language or null to removeVCardParameters.setLanguage(java.lang.String)
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.