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


Java BinaryBody类代码示例

本文整理汇总了Java中org.apache.james.mime4j.dom.BinaryBody的典型用法代码示例。如果您正苦于以下问题:Java BinaryBody类的具体用法?Java BinaryBody怎么用?Java BinaryBody使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: append

import org.apache.james.mime4j.dom.BinaryBody; //导入依赖的package包/类
/***************************************************************************/
private void append(StringBuilder sb, Body body) {
	if (body instanceof TextBody) {
		/*
		 * A text body. Display its contents.
		 */
		TextBody textBody = (TextBody) body;
		try {
			Reader r = textBody.getReader();
			int c;
			while ((c = r.read()) != -1) {
				sb.append((char) c);
			}
		} catch (IOException ex) {
			ex.printStackTrace();
		}

	} else if (body instanceof BinaryBody) {
		BinaryBody bBody = (BinaryBody) body;
		append(sb, bBody);
	} else if (body instanceof Multipart) {
		Multipart mbody = (Multipart) body;
		for (Entity part : mbody.getBodyParts()) {
			append(sb, part);
		}
	}

	/*
	 * Ignore Fields </br>
	 * 
	 * ContentTypeField,AddressListField,DateTimeField UnstructuredField,
	 * Field
	 * 
	 */
	else {
		sb.append(body.toString());
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:39,代码来源:MimeToHtmlWordAdapter.java

示例2: originalMessageBodyPart

import org.apache.james.mime4j.dom.BinaryBody; //导入依赖的package包/类
private BodyPart originalMessageBodyPart() {
    BinaryBody body = new MessageContentBody(originalMail.mailData);
    BodyPart result = new BodyPart();
    result.setBody(body, "message/rfc822");
    return result;
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:7,代码来源:DsnMailCreator.java

示例3: createNode

import org.apache.james.mime4j.dom.BinaryBody; //导入依赖的package包/类
/**
 * Creates the tree nodes given a MIME entity (either a Message or
 * a BodyPart).
 *
 * @param entity the entity.
 * @return the root node of the tree displaying the specified entity and
 *         its children.
 */
private DefaultMutableTreeNode createNode(Entity entity) {

    /*
     * Create the root node for the entity. It's either a
     * Message or a Body part.
     */
    String type = "Message";
    if (entity instanceof BodyPart) {
        type = "Body part";
    }
    DefaultMutableTreeNode node = new DefaultMutableTreeNode(
                                        new ObjectWrapper(type, entity));

    /*
     * Add the node encapsulating the entity Header.
     */
    node.add(createNode(entity.getHeader()));

    Body body = entity.getBody();

    if (body instanceof Multipart) {
        /*
         * The body of the entity is a Multipart.
         */

        node.add(createNode((Multipart) body));
    } else if (body instanceof MessageImpl) {
        /*
         * The body is another Message.
         */

        node.add(createNode((MessageImpl) body));

    } else {
        /*
         * Discrete Body (either of type TextBody or BinaryBody).
         */
        type = "Text body";
        if (body instanceof BinaryBody) {
            type = "Binary body";
        }

        type += " (" + entity.getMimeType() + ")";
        node.add(new DefaultMutableTreeNode(new ObjectWrapper(type, body)));

    }

    return node;
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:58,代码来源:MessageTreeViewMain.java


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