|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiweekly.Biweekly
public class Biweekly
Contains static chaining factory methods for reading/writing iCalendar objects.
Writing an iCalendar object
ICalendar ical = new ICalendar(); //string String icalString = Biweekly.write(ical).go(); //file File file = new File("meeting.ics"); Biweekly.write(ical).go(file); //writer Writer writer = ... Biweekly.write(ical).go(writer); writer.close();
Writing multiple iCalendar objects
ICalendar ical1 = new ICalendar(); ICalendar ical2 = new ICalendar(); String icalString = Biweekly.write(ical1, ical2).go();
Writing an XML-encoded iCalendar object (xCal)
//Call writeXml() instead of write() ICalendar ical = new ICalendar(); String xml = Biweekly.writeXml(ical).indent(2).go();
Reading an iCalendar object
ICalendar ical; //string String icalStr = ... ical = Biweekly.parse(icalStr).first(); //file File file = new File("meeting.ics"); ical = Biweekly.parse(file).first(); //reader Reader reader = ... ical = Biweekly.parse(reader).first(); reader.close();
Reading multiple iCalendar objects
String icalStr = ... List<ICalendar> icals = Biweekly.parse(icalStr).all();
Reading an XML-encoded iCalendar object (xCal)
//Call parseXml() instead of parse() String xml = ... ICalendar ical = Biweekly.parseXml(xml).first();
Retrieving parser warnings
String icalStr = ... List<List<String>> warnings = new ArrayList<List<String>>(); List<ICalendar> icals = Biweekly.parse(icalStr).warnings(warnings).all(); int i = 0; for (List<String> icalWarnings : warnings){ System.out.println("iCal #" + (i++) + " warnings:"); for (String warning : icalWarnings){ System.out.println(warning); } }
The methods in this class make use of the following classes. These classes can be used if greater control over the read/write operation is required:
Classes | Supports streaming? |
|
---|---|---|
Text | ICalReader / ICalWriter |
yes |
XML | XCalDocument |
no |
Nested Class Summary | |
---|---|
static class |
Biweekly.ParserChainTextReader
Chainer class for parsing plain text iCalendar data streams. |
static class |
Biweekly.ParserChainTextString
Chainer class for parsing plain text iCalendar strings. |
static class |
Biweekly.ParserChainXmlDocument
Chainer class for parsing XML-encoded iCalendar objects (xCal). |
static class |
Biweekly.ParserChainXmlReader
Chainer class for parsing XML-encoded iCalendar objects (xCal). |
static class |
Biweekly.ParserChainXmlString
Chainer class for parsing XML-encoded iCalendar objects (xCal). |
static class |
Biweekly.WriterChainTextMulti
Chainer class for writing to plain text iCalendar data streams. |
static class |
Biweekly.WriterChainTextSingle
Chainer class for writing to plain text iCalendar data streams. |
static class |
Biweekly.WriterChainXml
Chainer class for writing xCal documents (XML-encoded iCalendar objects). |
Field Summary | |
---|---|
static String |
URL
The project webpage. |
static String |
VERSION
The version of the library. |
Method Summary | |
---|---|
static Biweekly.ParserChainTextReader |
parse(File file)
Parses an iCalendar file. |
static Biweekly.ParserChainTextReader |
parse(InputStream in)
Parses an iCalendar data stream. |
static Biweekly.ParserChainTextReader |
parse(Reader reader)
Parses an iCalendar data stream. |
static Biweekly.ParserChainTextString |
parse(String ical)
Parses an iCalendar object string. |
static Biweekly.ParserChainXmlDocument |
parseXml(Document document)
Parses an xCal document (XML-encoded iCalendar objects). |
static Biweekly.ParserChainXmlReader |
parseXml(File file)
Parses an xCal document (XML-encoded iCalendar objects). |
static Biweekly.ParserChainXmlReader |
parseXml(InputStream in)
Parses an xCal document (XML-encoded iCalendar objects). |
static Biweekly.ParserChainXmlReader |
parseXml(Reader reader)
Parses an xCal document (XML-encoded iCalendar objects). |
static Biweekly.ParserChainXmlString |
parseXml(String xml)
Parses an xCal document (XML-encoded iCalendar objects). |
static Biweekly.WriterChainTextMulti |
write(Collection<ICalendar> icals)
Writes multiple iCalendar objects to a data stream. |
static Biweekly.WriterChainTextMulti |
write(ICalendar... icals)
Writes multiple iCalendar objects to a data stream. |
static Biweekly.WriterChainTextSingle |
write(ICalendar ical)
Writes an iCalendar object to a data stream. |
static Biweekly.WriterChainXml |
writeXml(Collection<ICalendar> icals)
Writes an xCal document (XML-encoded iCalendar objects). |
static Biweekly.WriterChainXml |
writeXml(ICalendar... icals)
Writes an xCal document (XML-encoded iCalendar objects). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VERSION
public static final String URL
Method Detail |
---|
public static Biweekly.ParserChainTextString parse(String ical)
ical
- the iCalendar data
public static Biweekly.ParserChainTextReader parse(File file) throws FileNotFoundException
FileNotFoundException
- if the file does not exist or cannot be
accessedpublic static Biweekly.ParserChainTextReader parse(InputStream in)
in
- the input stream
public static Biweekly.ParserChainTextReader parse(Reader reader)
reader
- the reader
public static Biweekly.WriterChainTextSingle write(ICalendar ical)
ical
- the iCalendar object to write
public static Biweekly.WriterChainTextMulti write(ICalendar... icals)
icals
- the iCalendar objects to write
public static Biweekly.WriterChainTextMulti write(Collection<ICalendar> icals)
icals
- the iCalendar objects to write
public static Biweekly.ParserChainXmlString parseXml(String xml)
xml
- the XML string
public static Biweekly.ParserChainXmlReader parseXml(File file) throws FileNotFoundException
file
- the XML file
FileNotFoundException
- if the file does not exist or cannot be
accessedpublic static Biweekly.ParserChainXmlReader parseXml(InputStream in)
in
- the input stream
public static Biweekly.ParserChainXmlReader parseXml(Reader reader)
reader
- the reader
public static Biweekly.ParserChainXmlDocument parseXml(Document document)
document
- the XML document
public static Biweekly.WriterChainXml writeXml(ICalendar... icals)
icals
- the iCalendar object(s) to write
public static Biweekly.WriterChainXml writeXml(Collection<ICalendar> icals)
icals
- the iCalendar objects to write
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |