From: adam Date: Sat, 17 Mar 2007 10:33:20 +0000 (+0000) Subject: more efficient MailboxIterator.head() in FileBasedMailbox X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2a1d65e90e0dbae298a366fdf865b0025d7b15ed;p=org.ibex.mail.git more efficient MailboxIterator.head() in FileBasedMailbox darcs-hash:20070317103320-5007d-a9d8a9ffdca54069e38c24427bbd2616cf2568dc.gz --- diff --git a/src/org/ibex/mail/FileBasedMailbox.java b/src/org/ibex/mail/FileBasedMailbox.java index 2a614d7..e13e22d 100644 --- a/src/org/ibex/mail/FileBasedMailbox.java +++ b/src/org/ibex/mail/FileBasedMailbox.java @@ -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 {