1 package de.j32.jpim.conduit;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.io.OutputStream;
7 import org.xml.sax.SAXException;
9 import de.j32.avmfritz.FritzBox;
10 import de.j32.util.Util;
12 public class FritzAddressbookConduit implements Conduit
16 public FritzAddressbookConduit() throws ConduitException
19 fb_ = new FritzBox(Config.get("fritzbox-password"), Config.get(
20 "fritzbox-url", "http://fritz.box"));
22 catch (SAXException e) {
23 throw new ConduitException(e);
25 catch (IOException e) {
26 throw new ConduitException(e);
31 public Exporter exporter() throws ConduitException
33 OutputStream os = null;
34 FritzAddressbookExporter exporter = null;
36 os = fb_.importAddressbook();
37 exporter = new FritzAddressbookExporter(os);
39 catch (IOException e) {
40 throw new ConduitException(e);
43 if (exporter == null) Util.nothrowClose(os);
49 public Importer importer() throws ConduitException
51 InputStream is = null;
52 FritzAddressbookImporter importer = null;
54 is = fb_.exportAddressbook();
55 importer = new FritzAddressbookImporter(is);
57 catch (IOException e) {
58 throw new ConduitException(e);
60 catch (SAXException e) {
61 throw new ConduitException(e);
64 if (importer == null) Util.nothrowClose(is);