biweekly.io.text
Class ICalRawReader

java.lang.Object
  extended by biweekly.io.text.ICalRawReader
All Implemented Interfaces:
Closeable

public class ICalRawReader
extends Object
implements Closeable

Parses an iCalendar data stream.

Author:
Michael Angstadt

Nested Class Summary
static interface ICalRawReader.ICalDataStreamListener
          Handles the iCalendar data as it is read off the data stream.
static class ICalRawReader.StopReadingException
          Instructs an ICalRawReader to stop reading from the data stream when thrown from an ICalRawReader.ICalDataStreamListener implementation.
 
Constructor Summary
ICalRawReader(Reader reader)
          Creates a new reader.
 
Method Summary
 void close()
          Closes the underlying Reader object.
 boolean eof()
          Determines whether the end of the data stream has been reached.
 int getLineNum()
          Gets the line number of the last line that was read.
 boolean isCaretDecodingEnabled()
           Gets whether the reader will decode parameter values that use circumflex accent encoding (enabled by default).
 void setCaretDecodingEnabled(boolean enable)
           Sets whether the reader will decode parameter values that use circumflex accent encoding (enabled by default).
 void start(ICalRawReader.ICalDataStreamListener listener)
          Starts or continues reading from the iCalendar data stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICalRawReader

public ICalRawReader(Reader reader)
Creates a new reader.

Parameters:
reader - the reader to the data stream
Method Detail

getLineNum

public int getLineNum()
Gets the line number of the last line that was read.

Returns:
the line number

start

public void start(ICalRawReader.ICalDataStreamListener listener)
           throws IOException
Starts or continues reading from the iCalendar data stream.

Parameters:
listener - handles the iCalendar data as it is read off the wire
Throws:
IOException - if there is an I/O problem

isCaretDecodingEnabled

public boolean isCaretDecodingEnabled()

Gets whether the reader will decode parameter values that use circumflex accent encoding (enabled by default). This escaping mechanism allows newlines and double quotes to be included in parameter values.

Raw Character Encoded Character
" ^'
newline ^n
^ ^^

Example:

 GEO;X-ADDRESS="Pittsburgh Pirates^n115 Federal St^nPitt
  sburgh, PA 15212":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 parameter values that use circumflex accent encoding (enabled by default). This escaping mechanism allows newlines and double quotes to be included in parameter values.

Raw Character Encoded Character
" ^'
newline ^n
^ ^^

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

eof

public boolean eof()
Determines whether the end of the data stream has been reached.

Returns:
true if the end has been reached, false if not

close

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

Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2013 Michael Angstadt. All Rights Reserved.