FileDocCategorySizeDatePackage
VCard21Format.javaAPI DocphoneME MR2 API (J2ME)3285Wed May 02 18:00:28 BST 2007com.sun.kvem.midp.pim.formats

VCard21Format

public class VCard21Format extends VCardFormat
Implementation of PIMEncoding for VCard/2.1.

Fields Summary
private static final String
PROPERTY_CATEGORY
Property used to store categories
private static final String
PROPERTY_CLASS
Property used to store access class.
Constructors Summary
Methods Summary
protected java.lang.StringgetBinaryEncodingName()
Returns name of encoding.

return
encoding name

        return "BASE64";
    
protected java.lang.StringgetCategoryProperty()
Returns the property category.

return
property category

        return PROPERTY_CATEGORY;
    
protected java.lang.StringgetClassProperty()
Returns class property.

return
class property

        return PROPERTY_CLASS;
    
protected java.lang.StringgetVersion()
Returns VCard version.

return
VCard version "2.1"

        return "2.1";
    
protected intparseAttributes(java.lang.String[] attributes)
Gets the binary value describing all flags in a vCard line.

param
attributes input selection attributes
return
binary attribute codes

        int code = 0;
        for (int i = 0; i < attributes.length; i++) {
            code |= VCardSupport.getAttributeCode(attributes[i], 0);
        }
        return code;
    
protected voidwriteAttributes(java.io.Writer w, int attributes)
Writes the attributes for a field.

param
w the output writer stream
param
attributes the attributes to be processed
throws
IOException if an error occurs writing

    
        
                                   
          
	  
        for (int i = 0; i < 32; i++) {
            long mask = 1l << i;
            if ((attributes & mask) != 0) {
                String attributeLabel =
                    VCardSupport.getAttributeLabel((int) mask);
                if (attributeLabel != null) {
                    w.write(';");
                    w.write(attributeLabel);
                }
            }
        }