import org.ibex.mail.*;
import org.ibex.util.*;
import org.ibex.io.*;
-import org.ibex.net.*;
import java.io.*;
import java.net.*;
import java.util.*;
}
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(uidNext)));
int ret = Integer.parseInt(br.readLine());
+ br.close();
if (inc) {
File tmp = new File(uidNext + "-");
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(tmp)));
((flags & Mailbox.Flag.ANSWERED) == Mailbox.Flag.ANSWERED ? "a" : "") +
((flags & Mailbox.Flag.FLAGGED) == Mailbox.Flag.FLAGGED ? "f" : "") +
((flags & Mailbox.Flag.SEEN) == Mailbox.Flag.SEEN ? "s" : "");
+ Log.info(this, " with chosen filename " + name);
File target = new File(name);
File f = new File(target.getCanonicalPath() + "-");
FileOutputStream fo = new FileOutputStream(f);
message.dump(new Stream(fo));
fo.close();
f.renameTo(target);
+ Log.info(this, " done writing.");
} catch (IOException e) { throw new MailException.IOException(e); }
}
private boolean seen = false, deleted = false, draft = false, flagged = false, answered = false, recent = false;
public Iterator() { names = new File(path).list(filter); }
+ public Message head() { return cur(); }
public Message cur() {
if (cur >= names.length) return null;
try {
File file = new File(path + File.separatorChar + names[cur]);
- return new Message(null, null, new Stream(new FileInputStream(file)));
+ FileInputStream fis = new FileInputStream(file);
+ Message ret = new Message(null, null, new Stream(fis));
+ fis.close();
+ return ret;
} catch (IOException e) { throw new MailException.IOException(e);
} catch (Message.Malformed e) { throw new MailException(e.getMessage()); }
}