From 2a1d65e90e0dbae298a366fdf865b0025d7b15ed Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 17 Mar 2007 10:33:20 +0000 Subject: [PATCH] more efficient MailboxIterator.head() in FileBasedMailbox darcs-hash:20070317103320-5007d-a9d8a9ffdca54069e38c24427bbd2616cf2568dc.gz --- src/org/ibex/mail/FileBasedMailbox.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) 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 { -- 1.7.10.4