⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
gnu.mail.providers.imap

Class IMAPFolder

java.lang.Object
|
+--javax.mail.Folder
   |
   +--gnu.mail.providers.imap.IMAPFolder


public class IMAPFolder
extends Folder

The folder class implementing the IMAP4rev1 mail protocol.
Author:

Field Summary

char

delimiter

int

messageCount

int

newMessageCount

String

path

The folder path.

Flags

permanentFlags

int

type

The type of this folder (HOLDS_MESSAGES or HOLDS_FOLDERS).

Constructor Summary

IMAPFolder(Store store, String path)

Constructor.

IMAPFolder(Store store, String path, char delimiter)

Constructor.

IMAPFolder(Store store, String path, int type, char delimiter)

Constructor.

Method Summary

void

appendMessages(Message messages)

Appends the specified set of messages to this folder.

void

close(boolean expunge)

Closes this folder.

boolean

create(int type)

Create this folder.

boolean

delete(boolean flag)

Delete this folder.

boolean

equals(Object other)

boolean

exists()

Indicates whether this folder exists.

Message[]

expunge()

Expunges this folder.

void

fetch(Message messages, FetchProfile fp)

IMAP fetch routine.

Folder

getFolder(String name)

Returns a subfolder with the specified name.

IMAPFolder

getFolder(String name, int type, char delimiter)

Returns a configured subfolder.

String

getFullName()

Returns the full path of this folder.

Message

getMessage(int msgnum)

Returns the specified message number from this folder.

int

getMessageCount()

Returns the number of messages in this folder.

String

getName()

Returns the name of this folder.

int

getNewMessageCount()

Returns the number of new messages in this folder.

Folder

getParent()

Returns the parent folder of this folder.

Flags

getPermanentFlags()

Returns the permanent flags for this folder.

char

getSeparator()

Returns the path separator charcter.

int

getType()

Returns the type of this folder.

boolean

hasNewMessages()

Indicates whether this folder contains new messages.

boolean

isOpen()

Indicates whether this folder is open.

Folder[]

list(String pattern)

Returns the subfolders for this folder.

Folder[]

listSubscribed(String pattern)

Returns the subscribed subfolders for this folder.

void

open(int mode)

Opens this folder.

boolean

renameTo(Folder folder)

Rename this folder.

Message[]

search(SearchTerm term)

IMAP search function.

Message[]

search(SearchTerm term, Message msgs)

IMAP search function.

Field Details

delimiter

protected char delimiter


messageCount

protected int messageCount


newMessageCount

protected int newMessageCount


path

protected String path

The folder path.


permanentFlags

protected Flags permanentFlags


type

protected int type

The type of this folder (HOLDS_MESSAGES or HOLDS_FOLDERS).

Constructor Details

IMAPFolder

protected IMAPFolder(Store store, String path)

Constructor.

Parameters:
store
path

IMAPFolder

protected IMAPFolder(Store store, String path, char delimiter)

Constructor.

Parameters:
store
path
delimiter

IMAPFolder

protected IMAPFolder(Store store, String path, int type, char delimiter)

Constructor.

Parameters:
store
path
type
delimiter

Method Details

appendMessages

public void appendMessages(Message messages)

Appends the specified set of messages to this folder. Only MimeMessages are accepted.

Parameters:
messages

close

public void close(boolean expunge)

Closes this folder.

Parameters:
expunge - if the folder is to be expunged before it is closed
Throws:
MessagingException - if a messaging error occurred

create

public boolean create(int type)

Create this folder.

Parameters:
type

delete

public boolean delete(boolean flag)

Delete this folder.

Parameters:
flag

equals

public boolean equals(Object other)

Parameters:
other

exists

public boolean exists()

Indicates whether this folder exists.

Throws:
MessagingException - if a messaging error occurred

expunge

public Message[] expunge()

Expunges this folder. This deletes all the messages marked as deleted.

Throws:
MessagingException - if a messaging error occurred

fetch

public void fetch(Message messages, FetchProfile fp)

IMAP fetch routine. This executes the fetch for the specified message numbers and updates the messages according to the message statuses returned.

Parameters:
messages
fp

getFolder

public Folder getFolder(String name)

Returns a subfolder with the specified name.

Parameters:
name

getFolder

protected IMAPFolder getFolder(String name, int type, char delimiter)

Returns a configured subfolder.

Parameters:
name
type
delimiter

getFullName

public String getFullName()

Returns the full path of this folder.


getMessage

public Message getMessage(int msgnum)

Returns the specified message number from this folder. The message is only retrieved once from the server. Subsequent getMessage() calls to the same message are cached. Since POP3 does not provide a mechanism for retrieving only part of the message (headers, etc), the entire message is retrieved.

Parameters:
msgnum
Throws:
MessagingException - if a messaging error occurred

getMessageCount

public int getMessageCount()

Returns the number of messages in this folder.

Throws:
MessagingException - if a messaging error occurred

getName

public String getName()

Returns the name of this folder.


getNewMessageCount

public int getNewMessageCount()

Returns the number of new messages in this folder.

Throws:
MessagingException - if a messaging error occurred

getParent

public Folder getParent()

Returns the parent folder of this folder.


getPermanentFlags

public Flags getPermanentFlags()

Returns the permanent flags for this folder.


getSeparator

public char getSeparator()

Returns the path separator charcter.


getType

public int getType()

Returns the type of this folder.

Throws:
MessagingException - if a messaging error occurred

hasNewMessages

public boolean hasNewMessages()

Indicates whether this folder contains new messages.

Throws:
MessagingException - if a messaging error occurred

isOpen

public boolean isOpen()

Indicates whether this folder is open.


list

public Folder[] list(String pattern)

Returns the subfolders for this folder.

Parameters:
pattern

listSubscribed

public Folder[] listSubscribed(String pattern)

Returns the subscribed subfolders for this folder.

Parameters:
pattern

open

public void open(int mode)

Opens this folder.

Parameters:
mode
Throws:
MessagingException - if a messaging error occurred

renameTo

public boolean renameTo(Folder folder)

Rename this folder.

Parameters:
folder

search

public Message[] search(SearchTerm term)

IMAP search function.

Parameters:
term

search

public Message[] search(SearchTerm term, Message msgs)

IMAP search function.

Parameters:
term
msgs