andrewgoal - 2014-04-12

Hello guys,
I'm newbie and my aim is to read ics stream file from URL, parse it with Publish method and output to Google calendar but I'm only able to read input and save output to ics file.

In my project I need to add this code but I don't know where because there is already a new URL set .. Someone can help me for code necessary for write ouput to Google Calendar?

url = new URL("https", "www.google.com", 443, "");
CalDavCalendarStore store = new CalDavCalendarStore("-//MacTI//WOCal//EN", url, PathResolver.GCAL);
store.connect("TEST", "TEST".toCharArray());
store.getCollections();

THIS IS PROJECT


public class ICalendarExample {

public static void main(String[] args) throws IOException, ValidationException, ParserException {

String calFile = "Output.ics";

//Creating a new calendar
net.fortuna.ical4j.model.Calendar calendar = new net.fortuna.ical4j.model.Calendar();
calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.PUBLISH);

URL url=new URL("http://site_example/servlet/gscl_fvcal&action=export");
calendar=Calendars.load(url);

//Saving an iCalendar file
FileOutputStream fout = new FileOutputStream(calFile);

CalendarOutputter outputter = new CalendarOutputter();
outputter.setValidating(false);
outputter.output(calendar, fout);

//Now Parsing an iCalendar file
FileInputStream fin = new FileInputStream(calFile);

CalendarBuilder builder = new CalendarBuilder();

calendar = builder.build(fin);

//Iterating over a Calendar
for (Iterator i = calendar.getComponents().iterator(); i.hasNext();) {
Component component = (Component) i.next();
System.out.println("Component [" + component.getName() + "]");

  for (Iterator j = component.getProperties().iterator(); j.hasNext();) {
      Property property = (Property) j.next();
      System.out.println("Property [" + property.getName() + ", " + property.getValue() + "]");
  }

}//for
}
}