ezvcard.io
Class XCardDocument

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

public class XCardDocument
extends Object

Converts vCards to their XML representation.

Author:
Michael Angstadt
See Also:
RFC 6351

Constructor Summary
XCardDocument()
           
 
Method Summary
 void addVCard(VCard vcard)
          Adds a vCard to the XML document
 CompatibilityMode getCompatibilityMode()
          Deprecated. 
 Document getDocument()
          Gets the XML document that was generated.
 List<String> getWarnings()
          Gets the warnings from the last vCard that was marshalled.
 boolean isAddProdId()
          Gets whether or not a "PRODID" type will be added to each vCard, saying that the vCard was generated by this library.
 void setAddProdId(boolean addProdId)
          Sets whether or not to add a "PRODID" type to each vCard, saying that the vCard was generated by this library.
 void setCompatibilityMode(CompatibilityMode compatibilityMode)
          Deprecated. 
 String write()
          Writes the XML document to a string without pretty-printing it.
 void write(File file)
          Writes the XML document to a file without pretty-printing it.
 void write(File file, int indent)
          Writes the XML document to a file and pretty-prints it.
 String write(int indent)
          Writes the XML document to a string and pretty-prints it.
 void write(OutputStream out)
          Writes the XML document to an output stream without pretty-printing it.
 void write(OutputStream out, int indent)
          Writes the XML document to an output stream and pretty-prints it.
 void write(Writer writer)
          Writes the XML document to a writer without pretty-printing it.
 void write(Writer writer, int indent)
          Writes the XML document to a writer and pretty-prints it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XCardDocument

public XCardDocument()
Method Detail

getCompatibilityMode

@Deprecated
public CompatibilityMode getCompatibilityMode()
Deprecated. 

Gets the compatibility mode. Used for customizing the marshalling process to target a particular application.

Returns:
the compatibility mode

setCompatibilityMode

@Deprecated
public void setCompatibilityMode(CompatibilityMode compatibilityMode)
Deprecated. 

Sets the compatibility mode. Used for customizing the marshalling process to target a particular application.

Parameters:
compatibilityMode - the compatibility mode

isAddProdId

public boolean isAddProdId()
Gets whether or not a "PRODID" type will be added to each vCard, saying that the vCard was generated by this library.

Returns:
true if it will be added, false if not (defaults to true)

setAddProdId

public void setAddProdId(boolean addProdId)
Sets whether or not to add a "PRODID" type to each vCard, saying that the vCard was generated by this library.

Parameters:
addProdId - true to add this type, false not to (defaults to true)

getWarnings

public List<String> getWarnings()
Gets the warnings from the last vCard that was marshalled. This list is reset every time a new vCard is written.

Returns:
the warnings or empty list if there were no warnings

getDocument

public Document getDocument()
Gets the XML document that was generated.

Returns:
the XML document

write

public String write()
Writes the XML document to a string without pretty-printing it.

Returns:
the XML string

write

public String write(int indent)
Writes the XML document to a string and pretty-prints it.

Parameters:
indent - the number of indent spaces to use for pretty-printing
Returns:
the XML string

write

public void write(OutputStream out)
           throws TransformerException
Writes the XML document to an output stream without pretty-printing it.

Parameters:
out - the output stream
Throws:
TransformerException - if there's a problem writing to the output stream

write

public void write(OutputStream out,
                  int indent)
           throws TransformerException
Writes the XML document to an output stream and pretty-prints it.

Parameters:
out - the output stream
indent - the number of indent spaces to use for pretty-printing
Throws:
TransformerException - if there's a problem writing to the output stream

write

public void write(File file)
           throws TransformerException,
                  IOException
Writes the XML document to a file without pretty-printing it.

Parameters:
file - the file
Throws:
TransformerException - if there's a problem writing to the file
IOException

write

public void write(File file,
                  int indent)
           throws TransformerException,
                  IOException
Writes the XML document to a file and pretty-prints it.

Parameters:
file - the file stream
indent - the number of indent spaces to use for pretty-printing
Throws:
TransformerException - if there's a problem writing to the file
IOException

write

public void write(Writer writer)
           throws TransformerException
Writes the XML document to a writer without pretty-printing it.

Parameters:
writer - the writer
Throws:
TransformerException - if there's a problem writing to the writer

write

public void write(Writer writer,
                  int indent)
           throws TransformerException
Writes the XML document to a writer and pretty-prints it.

Parameters:
writer - the writer
indent - the number of indent spaces to use for pretty-printing
Throws:
TransformerException - if there's a problem writing to the writer

addVCard

public void addVCard(VCard vcard)
Adds a vCard to the XML document

Parameters:
vcard - the vCard to add


Copyright © 2012-2013. All Rights Reserved.