Package i2p.susi.webmail
Class PersistentMailCache
- java.lang.Object
-
- i2p.susi.webmail.PersistentMailCache
-
class PersistentMailCache extends Object
Manage the on-disk cache. This is a custom format with subdirectories, gzipped files, and the encoded UIDL in the file name. We store either the headers or the full message. No, it is not Maildir format but we could add Maildir-style status suffixes (e.g. ":2.SR") later. Exporting to a Maildir format would be just ungzipping each file to a flat directory. This class should only be accessed from MailCache. TODO cached server caps and config.- Since:
- 0.9.14
-
-
Field Summary
Fields Modifier and Type Field Description static String
DIR_ATTACHMENTS
static String
DIR_IMPORT
-
Constructor Summary
Constructors Constructor Description PersistentMailCache(I2PAppContext ctx, String host, int port, String user, String pass, String folder)
Use the params to generate a unique directory name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteMail(Mail mail)
Delete data from disk.void
deleteMail(String uidl)
Delete data from disk.File
getAttachmentDir()
GzipFileBuffer
getFullBuffer(String uidl)
For reading or writing a new full mail (NOT headers only).File
getFullFile(String uidl)
File
getHeaderFile(String uidl)
boolean
getMail(Mail mail, boolean headerOnly)
Fetch any needed data from disk.Collection<Mail>
getMails()
Fetch all mails from disk.boolean
saveMail(Mail mail)
Save data to disk.
-
-
-
Field Detail
-
DIR_IMPORT
public static final String DIR_IMPORT
- See Also:
- Constant Field Values
-
DIR_ATTACHMENTS
public static final String DIR_ATTACHMENTS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PersistentMailCache
public PersistentMailCache(I2PAppContext ctx, String host, int port, String user, String pass, String folder) throws IOException
Use the params to generate a unique directory name. Does NOT load the mails in. Caller MUST call getMails().- Parameters:
pass
- ignoredfolder
- e.g. DIR_FOLDER- Throws:
IOException
-
-
Method Detail
-
getMails
public Collection<Mail> getMails()
Fetch all mails from disk.- Returns:
- a new collection
-
getMail
public boolean getMail(Mail mail, boolean headerOnly)
Fetch any needed data from disk.- Returns:
- success
-
saveMail
public boolean saveMail(Mail mail)
Save data to disk.- Returns:
- success
-
deleteMail
public void deleteMail(Mail mail)
Delete data from disk.
-
deleteMail
public void deleteMail(String uidl)
Delete data from disk.
-
getFullBuffer
public GzipFileBuffer getFullBuffer(String uidl)
For reading or writing a new full mail (NOT headers only). For writing, caller MUST call writeComplete() on rv. Does not necessarily exist.- Since:
- 0.9.35
-
getAttachmentDir
public File getAttachmentDir()
- Returns:
- non-null only for Drafts
- Since:
- 0.9.35
-
-