com.funambol.common.pim.vcard
Class VCardFormatter
java.lang.Object
com.funambol.common.pim.vcard.VCardFormatter
public class VCardFormatter
- extends java.lang.Object
This class implements a vCard 2.1 formatter for JSR75 contacts.
The class can be extended to customize the way or the order in which fields
are emitted. This class, like the ContactParserListener, has a fixed mapping
for the multivalue fields. See ContactParserListener for more details on this
mapping. In general the two implementations should be kept in sync and
consistent. One aspect that client are likely to need redefining is the way
photo's type is detected. J2ME has no standard way to detect the type of a
picture in a byte stream, so the basic implementation assumes the mime
types for contact pictures is "jpeg". Clients can extend the class and
redefine the getPhoto method to support custom image type detection.
Warning: the current implementation is not finished yet and not all fields
are mapped. This implementation is used in the BlackBerry so it handles the
BB fields only. It will be extended when needed.
Method Summary |
void |
format(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatAddress(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatAddress(java.lang.String[] address,
java.lang.String tag,
java.io.OutputStream os)
|
protected void |
formatBirthday(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatCategories(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatEmail(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatFaxTag(java.lang.StringBuffer out,
java.lang.String tag)
|
protected void |
formatField(java.lang.String tag,
java.lang.String value,
java.io.OutputStream os)
|
protected void |
formatFields(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatName(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatPhoto(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatTag(java.lang.StringBuffer out,
java.lang.String tag)
|
protected void |
formatTel(Contact contact,
java.io.OutputStream os,
boolean allFields)
|
protected void |
formatVersion(Contact contact,
java.io.OutputStream os)
|
protected java.lang.String |
getPhotoType(byte[] photo)
|
protected int[] |
getSupportedFields()
This method can be redefined to change the default behavior and ignore
unwanted fields. |
protected boolean |
isSupportedField(PIMList list,
int field)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEL_HOME_TAG
protected static final java.lang.String TEL_HOME_TAG
- See Also:
- Constant Field Values
TEL_WORK_TAG
protected static final java.lang.String TEL_WORK_TAG
- See Also:
- Constant Field Values
TEL_PAGER_TAG
protected static final java.lang.String TEL_PAGER_TAG
- See Also:
- Constant Field Values
FAX_WORK_TAG
protected static final java.lang.String FAX_WORK_TAG
- See Also:
- Constant Field Values
FAX_HOME_TAG
protected static final java.lang.String FAX_HOME_TAG
- See Also:
- Constant Field Values
FAX_OTHER_TAG
protected static final java.lang.String FAX_OTHER_TAG
- See Also:
- Constant Field Values
TEL_MOBILE_TAG
protected static final java.lang.String TEL_MOBILE_TAG
- See Also:
- Constant Field Values
TEL_OTHER_TAG
protected static final java.lang.String TEL_OTHER_TAG
- See Also:
- Constant Field Values
EMAIL_OTHER_TAG
protected static final java.lang.String EMAIL_OTHER_TAG
- See Also:
- Constant Field Values
EMAIL_HOME_TAG
protected static final java.lang.String EMAIL_HOME_TAG
- See Also:
- Constant Field Values
EMAIL_WORK_TAG
protected static final java.lang.String EMAIL_WORK_TAG
- See Also:
- Constant Field Values
pimUtils
protected PimUtils pimUtils
VCardFormatter
public VCardFormatter()
VCardFormatter
public VCardFormatter(java.lang.String defaultCharset)
format
public void format(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatFields
protected void formatFields(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
getPhotoType
protected java.lang.String getPhotoType(byte[] photo)
formatVersion
protected void formatVersion(Contact contact,
java.io.OutputStream os)
throws PIMException
- Throws:
PIMException
formatPhoto
protected void formatPhoto(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatName
protected void formatName(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatField
protected void formatField(java.lang.String tag,
java.lang.String value,
java.io.OutputStream os)
throws PIMException
- Throws:
PIMException
formatTag
protected void formatTag(java.lang.StringBuffer out,
java.lang.String tag)
formatTel
protected void formatTel(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatFaxTag
protected void formatFaxTag(java.lang.StringBuffer out,
java.lang.String tag)
formatAddress
protected void formatAddress(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatAddress
protected void formatAddress(java.lang.String[] address,
java.lang.String tag,
java.io.OutputStream os)
throws PIMException
- Throws:
PIMException
formatEmail
protected void formatEmail(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatCategories
protected void formatCategories(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
formatBirthday
protected void formatBirthday(Contact contact,
java.io.OutputStream os,
boolean allFields)
throws PIMException
- Throws:
PIMException
getSupportedFields
protected int[] getSupportedFields()
- This method can be redefined to change the default behavior and ignore
unwanted fields.
- Returns:
- a list of fields that are going to be supported or null if all
fields shall be supported.
isSupportedField
protected boolean isSupportedField(PIMList list,
int field)
Copyright © 2001-2009 Funambol.