a_vcard.android.syncml.pim.vcard
Class VCardParser_V30

java.lang.Object
  extended by a_vcard.android.syncml.pim.vcard.VCardParser_V21
      extended by a_vcard.android.syncml.pim.vcard.VCardParser_V30

public class VCardParser_V30
extends VCardParser_V21

This class is used to parse vcard3.0.
Please refer to vCard Specification 3.0 (http://tools.ietf.org/html/rfc2426)


Field Summary
 
Fields inherited from class a_vcard.android.syncml.pim.vcard.VCardParser_V21
DEFAULT_CHARSET, mBuilder, mEncoding, mReader, mWarningValueMap, sDefaultEncoding
 
Constructor Summary
VCardParser_V30()
           
 
Method Summary
protected  java.lang.String getBase64(java.lang.String firstString)
          vCard 3.0 does not require two CRLF at the last of BASE64 data.
protected  java.lang.String getLine()
           
protected  java.lang.String getNonEmptyLine()
          vCard 3.0 requires that the line with space at the beginning of the line must be combined with previous line.
protected  java.lang.String getVersion()
           
protected  void handleAgent(java.lang.String propertyValue)
          vCard 2.1 specifies AGENT allows one vcard entry.
protected  void handleAnyParam(java.lang.String paramName, java.lang.String paramValue)
          Mainly for "X-" type.
protected  void handleParams(java.lang.String params)
          vCard 3.0 allows iana-token as paramType, while vCard 2.1 does not.
protected  void handleType(java.lang.String ptypevalues)
          vCard 3.0 defines param = param-name "=" param-value *("," param-value) param-name = iana-token / x-name param-value = ptext / quoted-string quoted-string = DQUOTE QSAFE-CHAR DQUOTE
protected  boolean isValidEncoding(java.lang.String encoding)
           
protected  boolean isValidPropertyName(java.lang.String propertyName)
           
protected  java.lang.String maybeUnescape(char ch)
          Returns unescaped String if the character should be unescaped.
protected  java.lang.String maybeUnescapeText(java.lang.String text)
          ESCAPED-CHAR = "\\" / "\;" / "\," / "\n" / "\N") ; \\ encodes \, \n or \N encodes newline ; \; encodes ;, \, encodes , Note: Apple escape ':' into '\:' while does not escape '\'
protected  boolean readBeginVCard(boolean allowGarbage)
          vcard = [group "."] "BEGIN" ":" "VCARD" 1*CRLF 1*(contentline) ;A vCard object MUST include the VERSION, FN and N types.
protected  void readEndVCard(boolean useCache, boolean allowGarbage)
          The arguments useCache and allowGarbase are usually true and false accordingly when this function is called outside this function itself.
 
Methods inherited from class a_vcard.android.syncml.pim.vcard.VCardParser_V21
cancel, getQuotedPrintable, handleCharset, handleEncoding, handleLanguage, handleMultiplePropertyValue, handlePropertyValue, handleValue, parse, parse, parse, parseItem, parseItems, parseVCardFile, separateLineAndHandleGroup, showDebugInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VCardParser_V30

public VCardParser_V30()
Method Detail

getVersion

protected java.lang.String getVersion()
Overrides:
getVersion in class VCardParser_V21

isValidPropertyName

protected boolean isValidPropertyName(java.lang.String propertyName)
Overrides:
isValidPropertyName in class VCardParser_V21
Returns:
true when the propertyName is a valid property name.

isValidEncoding

protected boolean isValidEncoding(java.lang.String encoding)
Overrides:
isValidEncoding in class VCardParser_V21
Returns:
true when the encoding is a valid encoding.

getLine

protected java.lang.String getLine()
                            throws java.io.IOException
Overrides:
getLine in class VCardParser_V21
Returns:
String. It may be null, or its length may be 0
Throws:
java.io.IOException

getNonEmptyLine

protected java.lang.String getNonEmptyLine()
                                    throws java.io.IOException,
                                           VCardException
vCard 3.0 requires that the line with space at the beginning of the line must be combined with previous line.

Overrides:
getNonEmptyLine in class VCardParser_V21
Returns:
String with it's length > 0
Throws:
java.io.IOException
VCardException - when the stream reached end of line

readBeginVCard

protected boolean readBeginVCard(boolean allowGarbage)
                          throws java.io.IOException,
                                 VCardException
vcard = [group "."] "BEGIN" ":" "VCARD" 1*CRLF 1*(contentline) ;A vCard object MUST include the VERSION, FN and N types. [group "."] "END" ":" "VCARD" 1*CRLF

Overrides:
readBeginVCard in class VCardParser_V21
Returns:
True when successful. False when reaching the end of line
Throws:
java.io.IOException
VCardException

readEndVCard

protected void readEndVCard(boolean useCache,
                            boolean allowGarbage)
                     throws java.io.IOException,
                            VCardException
Description copied from class: VCardParser_V21
The arguments useCache and allowGarbase are usually true and false accordingly when this function is called outside this function itself.

Overrides:
readEndVCard in class VCardParser_V21
Parameters:
useCache - When true, line is obtained from mPreviousline. Otherwise, getLine() is used.
allowGarbage - When true, ignore non "END:VCARD" line.
Throws:
java.io.IOException
VCardException

handleParams

protected void handleParams(java.lang.String params)
                     throws VCardException
vCard 3.0 allows iana-token as paramType, while vCard 2.1 does not.

Overrides:
handleParams in class VCardParser_V21
Throws:
VCardException

handleAnyParam

protected void handleAnyParam(java.lang.String paramName,
                              java.lang.String paramValue)
Description copied from class: VCardParser_V21
Mainly for "X-" type. This accepts any kind of type without check.

Overrides:
handleAnyParam in class VCardParser_V21

handleType

protected void handleType(java.lang.String ptypevalues)
vCard 3.0 defines param = param-name "=" param-value *("," param-value) param-name = iana-token / x-name param-value = ptext / quoted-string quoted-string = DQUOTE QSAFE-CHAR DQUOTE

Overrides:
handleType in class VCardParser_V21

handleAgent

protected void handleAgent(java.lang.String propertyValue)
                    throws VCardException
Description copied from class: VCardParser_V21
vCard 2.1 specifies AGENT allows one vcard entry. It is not encoded at all. item = ... / [groups "."] "AGENT" [params] ":" vcard CRLF vcard = "BEGIN" [ws] ":" [ws] "VCARD" [ws] 1*CRLF items *CRLF "END" [ws] ":" [ws] "VCARD"

Overrides:
handleAgent in class VCardParser_V21
Throws:
VCardException

getBase64

protected java.lang.String getBase64(java.lang.String firstString)
                              throws java.io.IOException,
                                     VCardException
vCard 3.0 does not require two CRLF at the last of BASE64 data. It only requires that data should be MIME-encoded.

Overrides:
getBase64 in class VCardParser_V21
Throws:
java.io.IOException
VCardException

maybeUnescapeText

protected java.lang.String maybeUnescapeText(java.lang.String text)
ESCAPED-CHAR = "\\" / "\;" / "\," / "\n" / "\N") ; \\ encodes \, \n or \N encodes newline ; \; encodes ;, \, encodes , Note: Apple escape ':' into '\:' while does not escape '\'

Overrides:
maybeUnescapeText in class VCardParser_V21

maybeUnescape

protected java.lang.String maybeUnescape(char ch)
Description copied from class: VCardParser_V21
Returns unescaped String if the character should be unescaped. Return null otherwise. e.g. In vCard 2.1, "\;" should be unescaped into ";" while "\x" should not be.

Overrides:
maybeUnescape in class VCardParser_V21