public class XCardWriter extends StreamWriter
Writes xCards (XML-encoded vCards) in a streaming fashion.
Example:
VCard vcard1 = ... VCard vcard2 = ... File file = new File("vcards.xml"); XCardWriter xcardWriter = new XCardWriter(file); xcardWriter.write(vcard1); xcardWriter.write(vcard2); xcardWriter.close();
addProdId, index, versionStrict
Constructor and Description |
---|
XCardWriter(java.io.File file)
Creates an xCard writer.
|
XCardWriter(java.io.File file,
java.lang.String indent)
Creates an xCard writer.
|
XCardWriter(org.w3c.dom.Node parent)
Creates an xCard writer.
|
XCardWriter(java.io.OutputStream out)
Creates an xCard writer.
|
XCardWriter(java.io.OutputStream out,
java.lang.String indent)
Creates an xCard writer.
|
XCardWriter(java.io.Writer writer)
Creates an xCard writer.
|
XCardWriter(java.io.Writer writer,
java.lang.String indent)
Creates an xCard writer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_write(VCard vcard,
java.util.List<VCardProperty> properties)
Writes a vCard to the stream.
|
void |
close()
Terminates the XML document and closes the output stream.
|
protected VCardVersion |
getTargetVersion()
Gets the version that the next vCard will be written as.
|
void |
registerParameterDataType(java.lang.String parameterName,
VCardDataType dataType)
Registers the data type of an experimental parameter.
|
getScribeIndex, isAddProdId, isVersionStrict, registerScribe, setAddProdId, setScribeIndex, setVersionStrict, write
public XCardWriter(java.io.OutputStream out)
out
- the output stream to write the xCards topublic XCardWriter(java.io.OutputStream out, java.lang.String indent)
out
- the output stream to write the xCards toindent
- the indentation string to use for pretty printing (e.g.
"\t") or null not to pretty printpublic XCardWriter(java.io.File file) throws java.io.IOException
file
- the file to write the xCards tojava.io.IOException
- if there's a problem opening the filepublic XCardWriter(java.io.File file, java.lang.String indent) throws java.io.IOException
file
- the file to write the xCards toindent
- the indentation string to use for pretty printing (e.g.
"\t") or null not to pretty printjava.io.IOException
- if there's a problem opening the filepublic XCardWriter(java.io.Writer writer)
writer
- the writer to write topublic XCardWriter(java.io.Writer writer, java.lang.String indent)
writer
- the writer to write toindent
- the indentation string to use for pretty printing (e.g.
"\t") or null not to pretty printpublic XCardWriter(org.w3c.dom.Node parent)
parent
- the DOM node to add child elements toprotected void _write(VCard vcard, java.util.List<VCardProperty> properties) throws java.io.IOException
StreamWriter
_write
in class StreamWriter
vcard
- the vCard that is being writtenproperties
- the properties to writejava.io.IOException
- if there's a problem writing to the output streamprotected VCardVersion getTargetVersion()
StreamWriter
getTargetVersion
in class StreamWriter
public void registerParameterDataType(java.lang.String parameterName, VCardDataType dataType)
parameterName
- the parameter name (e.g. "x-foo")dataType
- the data type or null to removepublic void close() throws java.io.IOException
java.io.IOException
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.