ezvcard.io
Class HCardReader

java.lang.Object
  extended by ezvcard.io.HCardReader
All Implemented Interfaces:
IParser

public class HCardReader
extends Object
implements IParser

Reads vCards encoded in HTML (hCard format).

Author:
Michael Angstadt
See Also:
http://microformats.org/wiki/hcard

Field Summary
protected  CategoriesType categories
           
protected  VCard curVCard
           
protected  Elements embeddedVCards
           
protected  Map<String,Class<? extends VCardType>> extendedTypeClasses
           
protected  Iterator<Element> it
           
protected  List<LabelType> labels
           
protected  NicknameType nickname
           
protected  String pageUrl
           
protected  Elements vcardElements
           
protected  List<String> warnings
           
protected  List<String> warningsBuffer
           
 
Constructor Summary
HCardReader(File file)
           
HCardReader(File file, String pageUrl)
           
HCardReader(InputStream in)
           
HCardReader(InputStream in, String pageUrl)
           
HCardReader(Reader reader)
           
HCardReader(Reader reader, String pageUrl)
           
HCardReader(String html)
           
HCardReader(String html, String pageUrl)
           
HCardReader(URL url)
           
 
Method Summary
 List<String> getWarnings()
          Gets the warnings from the last vCard that was unmarshalled.
 VCard readNext()
          Reads the next vCard.
 void registerExtendedType(Class<? extends VCardType> clazz)
          Registers an extended type class.
 void unregisterExtendedType(Class<? extends VCardType> clazz)
          Removes an extended type class that was previously registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageUrl

protected String pageUrl

warnings

protected List<String> warnings

extendedTypeClasses

protected Map<String,Class<? extends VCardType>> extendedTypeClasses

vcardElements

protected Elements vcardElements

it

protected Iterator<Element> it

labels

protected List<LabelType> labels

warningsBuffer

protected List<String> warningsBuffer

curVCard

protected VCard curVCard

embeddedVCards

protected Elements embeddedVCards

nickname

protected NicknameType nickname

categories

protected CategoriesType categories
Constructor Detail

HCardReader

public HCardReader(URL url)
            throws IOException
Parameters:
url - the URL of the webpage
Throws:
IOException - if there's a problem loading the webpage

HCardReader

public HCardReader(InputStream in)
            throws IOException
Parameters:
in - the input stream to the HTML page
Throws:
IOException - if there's a problem reading the HTML page

HCardReader

public HCardReader(InputStream in,
                   String pageUrl)
            throws IOException
Parameters:
in - the input stream to the HTML page
pageUrl - the original URL of the HTML page
Throws:
IOException - if there's a problem reading the HTML page

HCardReader

public HCardReader(File file)
            throws IOException
Parameters:
file - the HTML file
Throws:
IOException - if there's a problem reading the HTML file

HCardReader

public HCardReader(File file,
                   String pageUrl)
            throws IOException
Parameters:
file - the HTML file
pageUrl - the original URL of the HTML page
Throws:
IOException - if there's a problem reading the HTML file

HCardReader

public HCardReader(Reader reader)
            throws IOException
Parameters:
reader - the input stream to the HTML page
Throws:
IOException - if there's a problem reading the HTML page

HCardReader

public HCardReader(Reader reader,
                   String pageUrl)
            throws IOException
Parameters:
reader - the input stream to the HTML page
pageUrl - the original URL of the HTML page
Throws:
IOException - if there's a problem reading the HTML page

HCardReader

public HCardReader(String html)
Parameters:
html - the HTML page

HCardReader

public HCardReader(String html,
                   String pageUrl)
Parameters:
html - the HTML page
pageUrl - the original URL of the HTML page
Method Detail

registerExtendedType

public void registerExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Registers an extended type class.

Specified by:
registerExtendedType in interface IParser
Parameters:
clazz - the extended type class to register (MUST have a public, no-arg constructor)

unregisterExtendedType

public void unregisterExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Removes an extended type class that was previously registered.

Specified by:
unregisterExtendedType in interface IParser
Parameters:
clazz - the extended type class to remove (MUST have a public, no-arg constructor)

getWarnings

public List<String> getWarnings()
Description copied from interface: IParser
Gets the warnings from the last vCard that was unmarshalled. This list is reset every time a new vCard is read.

Specified by:
getWarnings in interface IParser
Returns:
the warnings or empty list if there were no warnings

readNext

public VCard readNext()
Description copied from interface: IParser
Reads the next vCard.

Specified by:
readNext in interface IParser
Returns:
the next vCard or null if there are no more


Copyright © 2012-2013. All Rights Reserved.