public abstract class VCardParser extends Object
Constructor and Description |
---|
VCardParser() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addInterpreter(VCardInterpreter interpreter)
Registers one
VCardInterpreter instance, which receives events along with
vCard parsing. |
abstract void |
cancel()
Cancel parsing vCard.
|
abstract void |
parse(InputStream is)
Parses a whole InputStream as a vCard file and lets registered
VCardInterpreter
instances handle callbacks. |
void |
parse(InputStream is,
VCardInterpreter interpreter)
Deprecated.
|
abstract void |
parseOne(InputStream is)
Parses the first vCard entry in InputStream and lets registered
VCardInterpreter
instances handle callbacks. |
public abstract void addInterpreter(VCardInterpreter interpreter)
VCardInterpreter
instance, which receives events along with
vCard parsing.interpreter
- public abstract void parse(InputStream is) throws IOException, VCardException
Parses a whole InputStream as a vCard file and lets registered 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 parseOne(InputStream)
.
is
- The source to parse.IOException,
- VCardExceptionIOException
VCardException
public abstract void parseOne(InputStream is) throws IOException, VCardException
Parses the first vCard entry in InputStream and lets registered VCardInterpreter
instances handle callbacks.
This method finishes itself when the first entry ended.
Note that, registered VCardInterpreter
may still see multiple
VCardInterpreter.onEntryStarted()
/ 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
VCardInterpreter.onEntryStarted()
and VCardInterpreter.onEntryEnded()
calls. Callers should handle the situation by themselves.
is
- The source to parse.IOException,
- VCardExceptionIOException
VCardException
@Deprecated public void parse(InputStream is, VCardInterpreter interpreter) throws IOException, VCardException
addInterpreter(VCardInterpreter)
and
parse(InputStream)
IOException
VCardException
public abstract void cancel()
Cancel parsing vCard. Useful when you want to stop the parse in the other threads.
Actual cancel is done after parsing the current vcard.