|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.io.text.VCardRawWriter
public class VCardRawWriter
Writes data to an vCard data stream.
Nested Class Summary | |
---|---|
static interface |
VCardRawWriter.ProblemsListener
A listener whose methods are invoked when non-critical issues occur during the writing process. |
Constructor Summary | |
---|---|
VCardRawWriter(Writer writer,
VCardVersion version)
Creates a vCard raw writer using the standard folding scheme and newline sequence. |
|
VCardRawWriter(Writer writer,
VCardVersion version,
FoldingScheme foldingScheme)
Creates a vCard raw writer using the standard newline sequence. |
|
VCardRawWriter(Writer writer,
VCardVersion version,
FoldingScheme foldingScheme,
String newline)
Creates a vCard raw writer. |
Method Summary | |
---|---|
void |
close()
Closes the underlying Writer object. |
void |
flush()
Flushes the underlying Writer object. |
FoldingScheme |
getFoldingScheme()
Gets the rules for how each line is folded. |
String |
getNewline()
Gets the newline sequence that is used to separate lines. |
VCardRawWriter.ProblemsListener |
getProblemsListener()
Gets the problems listener. |
VCardVersion |
getVersion()
Gets the vCard version that the writer is adhering to. |
boolean |
isCaretEncodingEnabled()
Gets whether the writer will apply circumflex accent encoding on parameter values (disabled by default, only applies to 3.0 and 4.0 vCards). |
void |
setCaretEncodingEnabled(boolean enable)
Sets whether the writer will apply circumflex accent encoding on parameter values (disabled by default, only applies to 3.0 and 4.0 vCards). |
void |
setProblemsListener(VCardRawWriter.ProblemsListener problemsListener)
Sets the problems listener. |
void |
setVersion(VCardVersion version)
Sets the vCard version that the writer should adhere to. |
void |
writeBeginComponent(String componentName)
Writes a property marking the beginning of a component (in other words, writes a "BEGIN:NAME" property). |
void |
writeEndComponent(String componentName)
Writes a property marking the end of a component (in other words, writes a "END:NAME" property). |
void |
writeProperty(String propertyName,
String value)
Writes a property to the vCard data stream. |
void |
writeProperty(String group,
String propertyName,
VCardParameters parameters,
String value)
Writes a property to the vCard data stream. |
void |
writeVersion()
Writes a "VERSION" property, based on the vCard version that the writer is adhering to. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VCardRawWriter(Writer writer, VCardVersion version)
writer
- the writer to the data streamversion
- the vCard version to adhere topublic VCardRawWriter(Writer writer, VCardVersion version, FoldingScheme foldingScheme)
writer
- the writer to the data streamversion
- the vCard version to adhere tofoldingScheme
- the folding scheme to use or null not to fold at allpublic VCardRawWriter(Writer writer, VCardVersion version, FoldingScheme foldingScheme, String newline)
writer
- the writer to the data streamversion
- the vCard version to adhere tofoldingScheme
- the folding scheme to use or null not to fold at allnewline
- the newline sequence to useMethod Detail |
---|
public boolean isCaretEncodingEnabled()
Gets whether the writer will apply circumflex accent encoding on parameter values (disabled by default, only applies to 3.0 and 4.0 vCards). This escaping mechanism allows for newlines and double quotes to be included in parameter values.
When disabled, the writer will replace newlines with spaces and double quotes with single quotes.
Character | Replacement (when disabled) |
Replacement (when enabled) |
---|---|---|
" |
' |
^' |
newline | space |
^n |
^ |
^ |
^^ |
Example:
GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt sburgh, PA 15212":40.446816;80.00566
public void setCaretEncodingEnabled(boolean enable)
Sets whether the writer will apply circumflex accent encoding on parameter values (disabled by default, only applies to 3.0 and 4.0 vCards). This escaping mechanism allows for newlines and double quotes to be included in parameter values.
When disabled, the writer will replace newlines with spaces and double quotes with single quotes.
Character | Replacement (when disabled) |
Replacement (when enabled) |
---|---|---|
" |
' |
^' |
newline | space |
^n |
^ |
^ |
^^ |
Example:
GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt sburgh, PA 15212":40.446816;80.00566
enable
- true to use circumflex accent encoding, false not topublic VCardVersion getVersion()
public void setVersion(VCardVersion version)
version
- the versionpublic String getNewline()
public VCardRawWriter.ProblemsListener getProblemsListener()
public void setProblemsListener(VCardRawWriter.ProblemsListener problemsListener)
problemsListener
- the listener or null to removepublic FoldingScheme getFoldingScheme()
public void writeBeginComponent(String componentName) throws IOException
componentName
- the component name (e.g. "VCARD")
IOException
- if there's an I/O problempublic void writeEndComponent(String componentName) throws IOException
componentName
- the component name (e.g. "VCARD")
IOException
- if there's an I/O problempublic void writeVersion() throws IOException
IOException
- if there's an I/O problempublic void writeProperty(String propertyName, String value) throws IOException
propertyName
- the property name (e.g. "FN")value
- the property value
IllegalArgumentException
- if the property name contains invalid
characters
IOException
- if there's an I/O problempublic void writeProperty(String group, String propertyName, VCardParameters parameters, String value) throws IOException
group
- the group or null if there is no grouppropertyName
- the property name (e.g. "FN")parameters
- the property parametersvalue
- the property value (will be converted to "quoted-printable"
encoding if the Encoding.QUOTED_PRINTABLE
parameter is set)
IllegalArgumentException
- if the group or property name contains
invalid characters
IOException
- if there's an I/O problempublic void flush() throws IOException
Writer
object.
flush
in interface Flushable
IOException
- if there's a problem flushing the writerpublic void close() throws IOException
Writer
object.
close
in interface Closeable
IOException
- if there's a problem closing the writer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |