当前位置: 首页>>代码示例>>Java>>正文


Java MimeUtil.ENC_BASE64属性代码示例

本文整理汇总了Java中org.apache.james.mime4j.util.MimeUtil.ENC_BASE64属性的典型用法代码示例。如果您正苦于以下问题:Java MimeUtil.ENC_BASE64属性的具体用法?Java MimeUtil.ENC_BASE64怎么用?Java MimeUtil.ENC_BASE64使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.james.mime4j.util.MimeUtil的用法示例。


在下文中一共展示了MimeUtil.ENC_BASE64属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: binaryBodyPart

private MimeBodyPart binaryBodyPart() throws IOException,
        MessagingException {
    String encodedTestString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
            + "abcdefghijklmnopqrstuvwxyz0123456789+/\r\n";

    BinaryTempFileBody tempFileBody = new BinaryTempFileBody(MimeUtil.ENC_BASE64);

    InputStream in = new ByteArrayInputStream(
            encodedTestString.getBytes("UTF-8"));

    OutputStream out = tempFileBody.getOutputStream();
    try {
        IOUtils.copy(in, out);
    } finally {
        out.close();
    }

    MimeBodyPart bodyPart = new MimeBodyPart(tempFileBody,
            "application/octet-stream");
    bodyPart.setEncoding(MimeUtil.ENC_BASE64);

    return bodyPart;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:MessageTest.java

示例2: getEncodingforType

/**
 * Get a default content-transfer-encoding for use with a given content-type
 * when adding an unencoded attachment. It's possible that 8bit encodings
 * may later be converted to 7bit for 7bit transport.
 * <ul>
 * <li>null: base64
 * <li>message/rfc822: 8bit
 * <li>message/*: 7bit
 * <li>multipart/signed: 7bit
 * <li>multipart/*: 8bit
 * <li>*&#47;*: base64
 * </ul>
 *
 * @param type
 *            A String representing a MIME content-type
 * @return A String representing a MIME content-transfer-encoding
 */
public static String getEncodingforType(String type) {
    if (type == null) {
        return (MimeUtil.ENC_BASE64);
    } else if (MimeUtil.isMessage(type)) {
        return (MimeUtil.ENC_8BIT);
    } else if (isSameMimeType(type, "multipart/signed") || isMessage(type)) {
        return (MimeUtil.ENC_7BIT);
    } else if (isMultipart(type)) {
        return (MimeUtil.ENC_8BIT);
    } else {
        return (MimeUtil.ENC_BASE64);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:30,代码来源:MimeUtility.java

示例3: getEncodingforType

/**
 * Get a default content-transfer-encoding for use with a given content-type
 * when adding an unencoded attachment. It's possible that 8bit encodings
 * may later be converted to 7bit for 7bit transport.
 * <ul>
 * <li>null: base64
 * <li>message/rfc822: 8bit
 * <li>message/*: 7bit
 * <li>multipart/signed: 7bit
 * <li>multipart/*: 8bit
 * <li>*&#47;*: base64
 * </ul>
 *
 * @param type
 *            A String representing a MIME content-type
 * @return A String representing a MIME content-transfer-encoding
 */
public static String getEncodingforType(String type) {
    if (type == null) {
        return (MimeUtil.ENC_BASE64);
    } else if (MimeUtil.isMessage(type)) {
        return (MimeUtil.ENC_8BIT);
    } else if ("multipart/signed".equalsIgnoreCase(type) || type.toLowerCase(Locale.US).startsWith("message/")) {
        return (MimeUtil.ENC_7BIT);
    } else if (type.toLowerCase(Locale.US).startsWith("multipart/")) {
        return (MimeUtil.ENC_8BIT);
    } else {
        return (MimeUtil.ENC_BASE64);
    }
}
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:30,代码来源:MimeUtility.java

示例4: getEncodingforType

/**
 * Get a default content-transfer-encoding for use with a given content-type
 * when adding an unencoded attachment. It's possible that 8bit encodings
 * may later be converted to 7bit for 7bit transport.
 * <ul>
 * <li>null: base64
 * <li>message/rfc822: 8bit
 * <li>message/*: 7bit
 * <li>multipart/signed: 7bit
 * <li>multipart/*: 8bit
 * <li>*&#47;*: base64
 * </ul>
 *
 * @param type
 *            A String representing a MIME content-type
 * @return A String representing a MIME content-transfer-encoding
 */
public static String getEncodingforType(String type) {
    if (type == null) {
        return (MimeUtil.ENC_BASE64);
    } else if (MimeUtil.isMessage(type)) {
        return (MimeUtil.ENC_8BIT);
    } else if (type.contains("application/pgp-signature") || type.contains("application/pgp-encrypted") || type.toLowerCase(Locale.US).startsWith("message/")) {
        return (MimeUtil.ENC_7BIT);
    } else if (type.toLowerCase(Locale.US).startsWith("multipart/")) {
        return (MimeUtil.ENC_8BIT);
    } else {
        return (MimeUtil.ENC_BASE64);
    }
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:30,代码来源:MimeUtility.java


注:本文中的org.apache.james.mime4j.util.MimeUtil.ENC_BASE64属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。