当前位置: 首页>>代码示例>>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;未经允许,请勿转载。