abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1177046 - /abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
Date Wed, 28 Sep 2011 20:28:05 GMT
Author: jmsnell
Date: Wed Sep 28 20:28:05 2011
New Revision: 1177046

URL: http://svn.apache.org/viewvc?rev=1177046&view=rev
Log: (empty)

Added:
    abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
  (with props)

Added: abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java?rev=1177046&view=auto
==============================================================================
--- abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
(added)
+++ abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
Wed Sep 28 20:28:05 2011
@@ -0,0 +1,36 @@
+package org.apache.abdera2.examples.activities;
+
+import java.net.URL;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.activities.model.CollectionWriter;
+import org.apache.abdera2.activities.model.IO;
+import org.apache.abdera2.ext.activities.FeedToActivityConverter;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Feed;
+import org.apache.abdera2.parser.Parser;
+import org.apache.abdera2.parser.ParserOptions;
+
+public class FeedToStreamConversionExample {
+
+  public static void main(String... args) throws Exception {
+    
+    Abdera abdera = Abdera.getInstance();
+    URL url = new URL("http://intertwingly.net/blog/index.atom");
+    Parser parser = abdera.getParser();
+    ParserOptions options = parser.getDefaultParserOptions();
+    options.setCharset("UTF-8");
+    Document<Feed> doc = abdera.getParser().parse(url.openStream(),url.toString(),options);
+    Feed feed = doc.getRoot();
+
+    FeedToActivityConverter c = new FeedToActivityConverter() {};
+
+    IO io = IO.get();
+
+    CollectionWriter cw = io.getCollectionWriter(System.out, "UTF-8");
+
+    c.convert(feed, cw);
+    
+  }
+  
+}

Propchange: abdera/abdera2/examples/src/main/java/org/apache/abdera2/examples/activities/FeedToStreamConversionExample.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message