more efficient MailboxIterator.head() in FileBasedMailbox
authoradam <adam@megacz.com>
Sat, 17 Mar 2007 10:33:20 +0000 (10:33 +0000)
committeradam <adam@megacz.com>
Sat, 17 Mar 2007 10:33:20 +0000 (10:33 +0000)
darcs-hash:20070317103320-5007d-a9d8a9ffdca54069e38c24427bbd2616cf2568dc.gz

src/org/ibex/mail/FileBasedMailbox.java

index 2a614d7..e13e22d 100644 (file)
@@ -180,22 +180,8 @@ public class FileBasedMailbox extends Mailbox.Default {
             else if (f.lastModified()==MAGIC_DATE) f.setLastModified(System.currentTimeMillis());
             // FIXME
         }
-        public Headers head() {
-            if (done()) return null;
-            FileInputStream fis = null;
-            try {
-                return new Headers.Original(new Stream(new FileInputStream(file())));
-            } catch (IOException e) { throw new MailException.IOException(e);
-            } finally { if (fis != null) try { fis.close(); } catch (Exception e) { /* DELIBERATE */ } }
-        }
-        public Message cur() {
-            FileInputStream fis = null;
-            try {
-                return Message.newMessage(new Fountain.File(file()));
-                //} catch (IOException e) { throw new MailException.IOException(e);
-            } catch (Message.Malformed e) { throw new MailException(e.getMessage());
-            } finally { if (fis != null) try { fis.close(); } catch (Exception e) { /* DELIBERATE */ } }
-        }
+        public Headers head() { return done() ? null : new Headers(new Fountain.File(file())); }
+        public Message cur() { return Message.newMessage(new Fountain.File(file())); }
     }
 
     public static class Servlet extends HttpServlet {