FileDocCategorySizeDatePackage
VCardParser.javaAPI DocAndroid 5.1 API3239Thu Mar 12 22:22:54 GMT 2015com.android.vcard

VCardParser

public abstract class VCardParser extends Object

Fields Summary
Constructors Summary
Methods Summary
public abstract voidaddInterpreter(VCardInterpreter interpreter)
Registers one {@link VCardInterpreter} instance, which receives events along with vCard parsing.

param
interpreter

public abstract voidcancel()

Cancel parsing vCard. Useful when you want to stop the parse in the other threads.

Actual cancel is done after parsing the current vcard.

public abstract voidparse(java.io.InputStream is)

Parses a whole InputStream as a vCard file and lets registered {@link VCardInterpreter} instances handle callbacks.

This method reads a whole InputStream. If you just want to parse one vCard entry inside a vCard file with multiple entries, try {@link #parseOne(InputStream)}.

param
is The source to parse.
throws
IOException, VCardException

public voidparse(java.io.InputStream is, VCardInterpreter interpreter)

deprecated
use {@link #addInterpreter(VCardInterpreter)} and {@link #parse(InputStream)}

        addInterpreter(interpreter);
        parse(is);
    
public abstract voidparseOne(java.io.InputStream is)

Parses the first vCard entry in InputStream and lets registered {@link VCardInterpreter} instances handle callbacks.

This method finishes itself when the first entry ended.

Note that, registered {@link VCardInterpreter} may still see multiple {@link VCardInterpreter#onEntryStarted()} / {@link VCardInterpreter#onEntryEnded()} calls even with this method.

This happens when the first entry contains nested vCards, which is allowed in vCard 2.1. See the following example.

BEGIN:VCARD N:a BEGIN:VCARD N:b END:VCARD END:VCARD

With this vCard, registered interpreters will grab two {@link VCardInterpreter#onEntryStarted()} and {@link VCardInterpreter#onEntryEnded()} calls. Callers should handle the situation by themselves.

param
is The source to parse.
throws
IOException, VCardException