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(File file)
Creates an xCard writer.
|
XCardWriter(File file,
String indent)
Creates an xCard writer.
|
XCardWriter(Node parent)
Creates an xCard writer.
|
XCardWriter(OutputStream out)
Creates an xCard writer.
|
XCardWriter(OutputStream out,
String indent)
Creates an xCard writer.
|
XCardWriter(Writer writer)
Creates an xCard writer.
|
XCardWriter(Writer writer,
String indent)
Creates an xCard writer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_write(VCard vcard,
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(String parameterName,
VCardDataType dataType)
Registers the data type of an experimental parameter.
|
getScribeIndex, isAddProdId, isVersionStrict, registerScribe, setAddProdId, setScribeIndex, setVersionStrict, write
public XCardWriter(OutputStream out)
out
- the output stream to write the xCards topublic XCardWriter(OutputStream out, 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(File file) throws IOException
file
- the file to write the xCards toIOException
- if there's a problem opening the filepublic XCardWriter(File file, String indent) throws 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 printIOException
- if there's a problem opening the filepublic XCardWriter(Writer writer)
writer
- the writer to write topublic XCardWriter(Writer writer, 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(Node parent)
parent
- the DOM node to add child elements toprotected void _write(VCard vcard, List<VCardProperty> properties) throws IOException
StreamWriter
_write
in class StreamWriter
vcard
- the vCard that is being writtenproperties
- the properties to writeIOException
- if there's a problem writing to the output streamprotected VCardVersion getTargetVersion()
StreamWriter
getTargetVersion
in class StreamWriter
public void registerParameterDataType(String parameterName, VCardDataType dataType)
parameterName
- the parameter name (e.g. "x-foo")dataType
- the data type or null to removepublic void close() throws IOException
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.