public class MaildirMessageName extends Object
Modifier and Type | Field and Description |
---|---|
static FilenameFilter |
FILTER_DELETED_MESSAGES |
static FilenameFilter |
FILTER_UNSEEN_MESSAGES |
static String |
FLAG_ANSWERD |
static String |
FLAG_DELETED |
static String |
FLAG_DRAFT |
static String |
FLAG_FLAGGED |
static String |
FLAG_SEEN |
static Pattern |
PATTERN_DELETED_MESSAGES |
static Pattern |
PATTERN_MESSAGE |
static String |
PATTERN_STRING_FLAGS |
static String |
PATTERN_STRING_MESSAGE_NAME |
static String |
PATTERN_STRING_SIZE |
static Pattern |
PATTERN_UNSEEN_MESSAGES |
Constructor and Description |
---|
MaildirMessageName(MaildirFolder parentFolder,
String fullName) |
Modifier and Type | Method and Description |
---|---|
static FilenameFilter |
createRegexFilter(Pattern pattern) |
static MaildirMessageName |
createUniqueName(MaildirFolder parentFolder,
long size)
|
javax.mail.Flags |
decodeFlags(String flagsString)
Takes a String which is "Maildir encoded" and translates it
into a
Flags object. |
String |
encodeFlags(javax.mail.Flags flags)
Creates a String that represents the provided Flags
|
boolean |
exists()
Tests whether the file or directory belonging to this
MaildirFolder exists. |
String |
getBaseName()
Composes the base name consisting of timestamp, unique string and host name
witout the size and flags.
|
File |
getFile()
Returns a
File object of the message denoted by this MaildirMessageName . |
FilenameFilter |
getFilenameFilter()
Creates a filter which matches the message file even if the flags have changed
|
javax.mail.Flags |
getFlags()
Decodes the flags part of the file name if necessary and returns the appropriate Flags object.
|
String |
getFullName()
Returns the full name of this message including size and flags if available.
|
Date |
getInternalDate()
Decodes the time part of the file name if necessary and returns the appropriate Date.
|
Long |
getSize()
Decodes the size part of the file name if necessary and returns the appropriate Long.
|
static String |
optional(String pattern) |
void |
setFlags(javax.mail.Flags flags)
Sets new flags for this message name.
|
void |
setFullName(String fullName)
Sets the fullName of this
MaildirMessageName if different from the current one. |
String |
toString() |
public static final String FLAG_DRAFT
public static final String FLAG_FLAGGED
public static final String FLAG_ANSWERD
public static final String FLAG_SEEN
public static final String FLAG_DELETED
public static final String PATTERN_STRING_MESSAGE_NAME
public static final String PATTERN_STRING_FLAGS
public static final String PATTERN_STRING_SIZE
public static final Pattern PATTERN_MESSAGE
public static final Pattern PATTERN_UNSEEN_MESSAGES
public static final FilenameFilter FILTER_UNSEEN_MESSAGES
public static final Pattern PATTERN_DELETED_MESSAGES
public static final FilenameFilter FILTER_DELETED_MESSAGES
public MaildirMessageName(MaildirFolder parentFolder, String fullName)
public boolean exists()
MaildirFolder
exists.
If the file exists, its absolute path is written to absPath.
TODO: If the flags have changed or the file doesn't exist any more, the uidlist should be updatedMaildirFolder
exists ; false otherwisepublic void setFullName(String fullName)
MaildirMessageName
if different from the current one.
As this invalidates the parsed elements, they are being reset.fullName
- A name of a message file in the correct Maildir formatpublic String getFullName()
public File getFile() throws FileNotFoundException
File
object of the message denoted by this MaildirMessageName
.
Also checks for different flags if it cannot be found directly.File
objectFileNotFoundException
- If there is no file for the given namepublic FilenameFilter getFilenameFilter()
public void setFlags(javax.mail.Flags flags)
flags
- public javax.mail.Flags getFlags()
Flags
of this messagepublic Long getSize()
Long
public Date getInternalDate()
Date
public String getBaseName()
public String encodeFlags(javax.mail.Flags flags)
flags
- The flags to encodepublic javax.mail.Flags decodeFlags(String flagsString)
Flags
object.flagsString
- The String with the flagspublic static MaildirMessageName createUniqueName(MaildirFolder parentFolder, long size)
public static FilenameFilter createRegexFilter(Pattern pattern)
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.