本文整理匯總了Java中javax.mail.Folder.getStore方法的典型用法代碼示例。如果您正苦於以下問題:Java Folder.getStore方法的具體用法?Java Folder.getStore怎麽用?Java Folder.getStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.mail.Folder
的用法示例。
在下文中一共展示了Folder.getStore方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: closeStoreConnection
import javax.mail.Folder; //導入方法依賴的package包/類
/**
* Close connection
* <b>Note</b>Internal method
* @throws MessagingException
*/
public void closeStoreConnection(
boolean storeConnected ) throws MessagingException {
if (storeConnected) {
// the folder is empty when the message is not loaded from IMAP server, but from a file
Folder imapFolder = message.getFolder();
if (imapFolder == null) {
imapFolder = partOfImapFolder; // in case of nested package but still originating from IMAP server
}
if (imapFolder != null) {
Store store = imapFolder.getStore();
if (store != null && store.isConnected()) {
// closing store closes and its folders
log.debug("Closing store (" + store.toString() + ") and associated folders");
store.close();
}
}
}
}
示例2: reconnectStoreIfClosed
import javax.mail.Folder; //導入方法依賴的package包/類
/**
* Reconnects if connection is closed.
* <b>Note</b>Internal method
* @return true if store re-connection is performed and this means that close should be closed after the work is done
* @throws MessagingException
*/
public boolean reconnectStoreIfClosed() throws MessagingException {
boolean storeReconnected = false;
// the folder is empty when the message is not loaded from IMAP server, but from a file
Folder imapFolder = message.getFolder();
if (imapFolder == null) {
imapFolder = this.partOfImapFolder;
} else {
partOfImapFolder = imapFolder; // keep reference
}
if (imapFolder != null) {
Store store = imapFolder.getStore();
if (store != null) {
if (!store.isConnected()) {
log.debug("Reconnecting store... ");
store.connect();
storeReconnected = true;
}
// Open folder in read-only mode
if (!imapFolder.isOpen()) {
log.debug("Reopening folder " + imapFolder.getFullName()
+ " in order to get contents of mail message");
imapFolder.open(Folder.READ_ONLY);
}
}
}
return storeReconnected;
}
示例3: supportsIdle
import javax.mail.Folder; //導入方法依賴的package包/類
protected boolean supportsIdle(Folder folder) throws MessagingException {
Store store = folder.getStore();
if (store instanceof IMAPStore) {
IMAPStore imapStore = (IMAPStore) store;
return imapStore.hasCapability("IDLE") && folder instanceof IMAPFolder;
} else {
return false;
}
}
示例4: JavaxMailFolder
import javax.mail.Folder; //導入方法依賴的package包/類
public JavaxMailFolder(Folder delegate) {
super(delegate.getStore());
this.delegate = delegate;
}