當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。