--- /dev/null
+package de.j32.pimstuff;
+
+import java.io.IOException;
+
+import de.j32.pimstuff.conduit.Conduit;
+import de.j32.pimstuff.conduit.ConduitException;
+import de.j32.pimstuff.conduit.Exporter;
+import de.j32.pimstuff.conduit.Importer;
+import de.j32.pimstuff.data.EntryConsumer;
+import de.j32.pimstuff.data.EntryProducer;
+import de.j32.util.Util;
+
+public class Data
+{
+ public static void transfer(EntryProducer producer, EntryConsumer consumer)
+ {
+ // TODO: It would be more 'beautoful' to have the EntryProducer be an
+ // Iterable, but this is simpler ...
+ producer.sendTo(consumer);
+ }
+
+ public static void transfer(Conduit conduit, EntryConsumer consumer) throws ConduitException,
+ IOException
+ {
+ Importer importer = null;
+ try {
+ importer = conduit.importer();
+ transfer(importer, consumer);
+ importer.close();
+ importer = null;
+ }
+ finally {
+ Util.nothrowClose(importer);
+ }
+ }
+
+ public static void transfer(EntryProducer producer, Conduit conduit) throws ConduitException,
+ IOException
+ {
+ Exporter exporter = null;
+ try {
+ exporter = conduit.exporter();
+ transfer(producer, exporter);
+ exporter.close();
+ exporter = null;
+ }
+ finally {
+ Util.nothrowClose(exporter);
+ }
+ }
+}