ezvcard.io
Class VCardReader

java.lang.Object
  extended by ezvcard.io.VCardReader
All Implemented Interfaces:
IParser, Closeable

public class VCardReader
extends Object
implements Closeable, IParser

Unmarshals vCards into VCard objects.

Author:
Michael Angstadt

Constructor Summary
VCardReader(File file)
           
VCardReader(InputStream in)
           
VCardReader(Reader reader)
           
VCardReader(String str)
           
 
Method Summary
 void close()
          Closes the underlying Reader object.
 CompatibilityMode getCompatibilityMode()
          Deprecated. 
 List<String> getWarnings()
          Gets the warnings from the last vCard that was unmarshalled.
 boolean isCaretDecodingEnabled()
           Gets whether the reader will decode characters in parameter values that use circumflex accent encoding.
 VCard readNext()
          Reads the next vCard.
 void registerExtendedType(Class<? extends VCardType> clazz)
          Registers an extended type class.
 void setCaretDecodingEnabled(boolean enable)
           Sets whether the reader will decode characters in parameter values that use circumflex accent encoding.
 void setCompatibilityMode(CompatibilityMode compatibilityMode)
          Deprecated. 
 void unregisterExtendedType(Class<? extends VCardType> clazz)
          Removes an extended type class that was previously registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VCardReader

public VCardReader(String str)
Parameters:
str - the string to read the vCards from

VCardReader

public VCardReader(InputStream in)
Parameters:
in - the input stream to read the vCards from

VCardReader

public VCardReader(File file)
            throws FileNotFoundException
Parameters:
file - the file to read the vCards from
Throws:
FileNotFoundException - if the file doesn't exist

VCardReader

public VCardReader(Reader reader)
Parameters:
reader - the reader to read the vCards from
Method Detail

isCaretDecodingEnabled

public boolean isCaretDecodingEnabled()

Gets whether the reader will decode characters in parameter values that use circumflex accent encoding. This escaping mechanism allows for newlines and double quotes to be included in parameter values.

Raw Encoded
" ^'
newline ^n
^ ^^

This setting is enabled by default and is only used with 3.0 and 4.0 vCards.

Example:

 GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt
  sburgh, PA 15212":geo:40.446816,-80.00566
 

Returns:
true if circumflex accent decoding is enabled, false if not
See Also:
RFC 6868

setCaretDecodingEnabled

public void setCaretDecodingEnabled(boolean enable)

Sets whether the reader will decode characters in parameter values that use circumflex accent encoding. This escaping mechanism allows for newlines and double quotes to be included in parameter values.

Raw Encoded
" ^'
newline ^n
^ ^^

This setting is enabled by default and is only used with 3.0 and 4.0 vCards.

Example:

 GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt
  sburgh, PA 15212":geo:40.446816,-80.00566
 

Parameters:
enable - true to use circumflex accent decoding, false not to
See Also:
RFC 6868

getCompatibilityMode

@Deprecated
public CompatibilityMode getCompatibilityMode()
Deprecated. 

Gets the compatibility mode. Used for customizing the unmarshalling process based on the application that generated the vCard.

Returns:
the compatibility mode

setCompatibilityMode

@Deprecated
public void setCompatibilityMode(CompatibilityMode compatibilityMode)
Deprecated. 

Sets the compatibility mode. Used for customizing the unmarshalling process based on the application that generated the vCard.

Parameters:
compatibilityMode - the compatibility mode

registerExtendedType

public void registerExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Registers an extended type class.

Specified by:
registerExtendedType in interface IParser
Parameters:
clazz - the extended type class to register (MUST have a public, no-arg constructor)

unregisterExtendedType

public void unregisterExtendedType(Class<? extends VCardType> clazz)
Description copied from interface: IParser
Removes an extended type class that was previously registered.

Specified by:
unregisterExtendedType in interface IParser
Parameters:
clazz - the extended type class to remove (MUST have a public, no-arg constructor)

getWarnings

public List<String> getWarnings()
Description copied from interface: IParser
Gets the warnings from the last vCard that was unmarshalled. This list is reset every time a new vCard is read.

Specified by:
getWarnings in interface IParser
Returns:
the warnings or empty list if there were no warnings

readNext

public VCard readNext()
               throws IOException
Description copied from interface: IParser
Reads the next vCard.

Specified by:
readNext in interface IParser
Returns:
the next vCard or null if there are no more
Throws:
IOException - if there's a problem reading from the stream

close

public void close()
           throws IOException
Closes the underlying Reader object.

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2012-2013. All Rights Reserved.