當前位置: 首頁>>代碼示例>>Java>>正文


Java ImapConstants類代碼示例

本文整理匯總了Java中com.icegreen.greenmail.imap.ImapConstants的典型用法代碼示例。如果您正苦於以下問題:Java ImapConstants類的具體用法?Java ImapConstants怎麽用?Java ImapConstants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImapConstants類屬於com.icegreen.greenmail.imap包,在下文中一共展示了ImapConstants類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getQuota

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
@Override
public Quota[] getQuota(final String root, final String qualifiedRootPrefix) {
    Set<String> rootPaths = new HashSet<>();
    if (!root.contains(ImapConstants.HIERARCHY_DELIMITER)) {
        rootPaths.add(qualifiedRootPrefix + root);
    } else {
        for (String r : root.split(ImapConstants.HIERARCHY_DELIMITER)) {
            rootPaths.add(qualifiedRootPrefix + r);
        }
    }
    rootPaths.add(qualifiedRootPrefix); // Add default root

    Set<Quota> collectedQuotas = new HashSet<>();
    for (String p : rootPaths) {
        Set<Quota> quotas = quotaMap.get(p);
        if (null != quotas) {
            collectedQuotas.addAll(quotas);
        }
    }
    updateQuotas(collectedQuotas, qualifiedRootPrefix);
    return collectedQuotas.toArray(new Quota[collectedQuotas.size()]);
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:23,代碼來源:InMemoryStore.java

示例2: updateQuota

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
private void updateQuota(final Quota quota, final String pQualifiedRootPrefix) {
    MailFolder folder = getMailbox(
            ImapConstants.USER_NAMESPACE + ImapConstants.HIERARCHY_DELIMITER +
                    pQualifiedRootPrefix + ImapConstants.HIERARCHY_DELIMITER +
                    quota.quotaRoot);
    try {
        for (Quota.Resource r : quota.resources) {
            if (STORAGE.equals(r.name)) {
                long size = 0;
                for (StoredMessage m : folder.getMessages()) {
                    size += m.getMimeMessage().getSize();
                }
                r.usage = size;
            } else if (MESSAGES.equals(r.name)) {
                r.usage = folder.getMessageCount();
            } else {
                throw new IllegalStateException("Quota " + r.name + " not supported");
            }
        }
    } catch (MessagingException ex) {
        throw new IllegalStateException("Can not update/verify quota " + quota, ex);
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:24,代碼來源:InMemoryStore.java

示例3: newMimeMessage

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
/**
 * Convenience method which creates a new {@link MimeMessage} from a string
 *
 * @throws MessagingException
 */
public static MimeMessage newMimeMessage(String mailString) throws MessagingException
{
    byte[] bytes = null;
    try {
        bytes = mailString.getBytes(ImapConstants.EIGHT_BIT_ENCODING);
    } catch (UnsupportedEncodingException e) {
        bytes = mailString.getBytes();
    }
    return newMimeMessage(new ByteArrayInputStream(bytes));
}
 
開發者ID:Alfresco,項目名稱:alfresco-greenmail,代碼行數:16,代碼來源:GreenMailUtil.java

示例4: getBodyAsBytes

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
public static byte[] getBodyAsBytes(Part msg) {
    try {
        return getBody(msg).getBytes(ImapConstants.EIGHT_BIT_ENCODING);
    } catch (UnsupportedEncodingException e) {
    return getBody(msg).getBytes();
}
}
 
開發者ID:Alfresco,項目名稱:alfresco-greenmail,代碼行數:8,代碼來源:GreenMailUtil.java

示例5: getHeaderAsBytes

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
public static  byte[] getHeaderAsBytes(Part part) {
    try {
        return getHeaders(part).getBytes(ImapConstants.EIGHT_BIT_ENCODING);
    } catch (UnsupportedEncodingException e) {
    return getHeaders(part).getBytes();
}
}
 
開發者ID:Alfresco,項目名稱:alfresco-greenmail,代碼行數:8,代碼來源:GreenMailUtil.java

示例6: delete

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
@Override
public void delete() {
    try {
        imapHostManager.deleteMailbox(this, ImapConstants.INBOX_NAME);
    } catch (FolderException | AuthorizationException e) {
        throw new IllegalStateException("Can not delete user " + this, e);
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:9,代碼來源:UserImpl.java

示例7: renameMailbox

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
@Override
public void renameMailbox(MailFolder existingFolder, String newName) throws FolderException {
    HierarchicalFolder toRename = (HierarchicalFolder) existingFolder;
    HierarchicalFolder parent = toRename.getParent();

    int idx = newName.lastIndexOf(ImapConstants.HIERARCHY_DELIMITER_CHAR);
    String newFolderName;
    String newFolderPathWithoutName;
    if (idx > 0) {
        newFolderName = newName.substring(idx + 1);
        newFolderPathWithoutName = newName.substring(0, idx);
    } else {
        newFolderName = newName;
        newFolderPathWithoutName = "";
    }

    if (parent.getName().equals(newFolderPathWithoutName)) {
        // Simple rename
        toRename.setName(newFolderName);
    } else {
        // Hierarchy change
        parent.getChildren().remove(toRename);
        HierarchicalFolder userFolder = getInboxOrUserRootFolder(toRename);
        String[] path = newName.split('\\' + ImapConstants.HIERARCHY_DELIMITER);
        HierarchicalFolder newParent = userFolder;
        for (int i = 0; i < path.length - 1; i++) {
            newParent = newParent.getChild(path[i]);
        }
        toRename.moveToNewParent(newParent);
        toRename.setName(newFolderName);
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:33,代碼來源:InMemoryStore.java

示例8: getInboxOrUserRootFolder

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
private HierarchicalFolder getInboxOrUserRootFolder(HierarchicalFolder folder) {
    final HierarchicalFolder inboxFolder = findParentByName(folder, ImapConstants.INBOX_NAME);
    if(null==inboxFolder) {
        return folder.getParent();
    }
    return inboxFolder.getParent();
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:8,代碼來源:InMemoryStore.java

示例9: RootFolder

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
public RootFolder() {
    super(null, ImapConstants.USER_NAMESPACE);
}
 
開發者ID:Alfresco,項目名稱:alfresco-greenmail,代碼行數:4,代碼來源:InMemoryStore.java

示例10: getFullName

import com.icegreen.greenmail.imap.ImapConstants; //導入依賴的package包/類
@Override
public String getFullName() {
    return parent.getFullName() + ImapConstants.HIERARCHY_DELIMITER_CHAR + name;
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:5,代碼來源:HierarchicalFolder.java


注:本文中的com.icegreen.greenmail.imap.ImapConstants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。