本文整理汇总了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;
}