major simplifications to Iterator api
[org.ibex.mail.git] / src / org / ibex / mail / target / Transcript.java
index 5d105bf..af70e95 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
 package org.ibex.mail.target;
 import org.ibex.mail.*;
 import org.ibex.util.*;
@@ -8,7 +12,7 @@ import java.util.*;
 import java.text.*;
 
 /** a fast-write, slow-read place to stash all messages we touch -- in case of a major f*ckup */
-public class Transcript extends Target {
+public class Transcript implements Target {
 
     public static final Transcript transcript = new Transcript(Mailbox.STORAGE_ROOT + File.separatorChar + "transcript");
 
@@ -34,9 +38,10 @@ public class Transcript extends Target {
                 
             File target = new File(today.getPath() + File.separatorChar + time + ".txt");
             OutputStream os = new FileOutputStream(target);
-            message.dump(new Stream(os));
-            os.flush();
-            os.close();
+            try {
+                message.getStream().transcribe(new Stream(os));
+                os.flush();
+            } finally { os.close(); }
         } catch (IOException e) { throw new MailException.IOException(e); }
     }
 }