ezvcard.io
Class HCardPage

java.lang.Object
  extended by ezvcard.io.HCardPage

public class HCardPage
extends Object

Writes vCards to an HTML page (hCard format).

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

Nested Class Summary
static class HCardPage.DataUriGenerator
          Generates data URIs for the freemarker template.
 
Field Summary
protected static Template template
           
protected  List<VCard> vcards
           
 
Constructor Summary
HCardPage()
           
 
Method Summary
 void addVCard(VCard vcard)
          Adds a vCard to the HTML page.
protected  PhotoType readImage(String name, ImageTypeParameter mediaType)
          Reads an image from the classpath.
 String write()
          Writes the HTML document to a string.
 void write(File file)
          Writes the HTML document to a file.
 void write(OutputStream out)
          Writes the HTML document to an output stream.
 void write(Writer writer)
          Writes the HTML document to a writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

protected static final Template template

vcards

protected final List<VCard> vcards
Constructor Detail

HCardPage

public HCardPage()
Method Detail

addVCard

public void addVCard(VCard vcard)
Adds a vCard to the HTML page.

Parameters:
vcard - the vCard to add

write

public String write()
             throws TemplateException
Writes the HTML document to a string.

Returns:
the HTML document
Throws:
TemplateException - if there's a problem with the freemarker template

write

public void write(OutputStream out)
           throws IOException,
                  TemplateException
Writes the HTML document to an output stream.

Parameters:
out - the output stream
Throws:
IOException - if there's a problem writing to the output stream
TemplateException - if there's a problem with the freemarker template

write

public void write(File file)
           throws IOException,
                  TemplateException
Writes the HTML document to a file.

Parameters:
file - the file
Throws:
IOException - if there's a problem writing to the file
TemplateException - if there's a problem with the freemarker template

write

public void write(Writer writer)
           throws IOException,
                  TemplateException
Writes the HTML document to a writer.

Parameters:
writer - the writer
Throws:
IOException - if there's a problem writing to the writer
TemplateException - if there's a problem with the freemarker template

readImage

protected PhotoType readImage(String name,
                              ImageTypeParameter mediaType)
                       throws IOException
Reads an image from the classpath.

Parameters:
name - the file name, relative to this class
mediaType - the media type of the image
Returns:
the image
Throws:
IOException


Copyright © 2012-2013. All Rights Reserved.