Coverage report

  %line %branch
com.ozacc.mail.fetch.impl.sk_jp.PlainPartExtractor
0% 
0% 

 1  
 /*
 2  
  * @(#) $Id: PlainPartExtractor.java,v 1.1.2.1 2004/09/29 00:57:59 otsuka Exp $
 3  
  * $Revision: 1.1.2.1 $
 4  
  * Copyright (c) 2000 Shin Kinoshita All Rights Reserved.
 5  
  */
 6  
 package com.ozacc.mail.fetch.impl.sk_jp;
 7  
 
 8  
 import java.io.IOException;
 9  
 
 10  
 import javax.mail.MessagingException;
 11  
 import javax.mail.Part;
 12  
 import javax.mail.internet.ContentType;
 13  
 import javax.mail.internet.MimeMessage;
 14  
 
 15  
 /**
 16  
  * text/plain¤ò·?¹ç¤·¤¿Ê¸»úÎó¤òÆÀ¤?PartHandler¤Ç¤¹¡£
 17  
  * 
 18  
  * @version $Revision: 1.1.2.1 $ $Date: 2004/09/29 00:57:59 $
 19  
  * @author Shin
 20  
  */
 21  0
 public class PlainPartExtractor implements PartHandler {
 22  
 
 23  0
 	private String text = null;
 24  
 
 25  
 	public boolean processPart(Part part, ContentType context) throws MessagingException,
 26  
 																IOException {
 27  0
 		if (!part.isMimeType("text/plain")) {
 28  0
 			return true;
 29  
 		}
 30  0
 		if (text == null) {
 31  
 			// ºÇ½é¤Î¥Æ¥­¥¹¥È¥Ñ¡¼¥È¤ò̵¾ò·?¤ËÃ?½Ð
 32  0
 			text = (String)MultipartUtility.getContent(part);
 33  
 		} else {
 34  0
 			String disposition = part.getDisposition();
 35  0
 			if (disposition == null || disposition.equalsIgnoreCase(Part.INLINE)) {
 36  0
 				text += "\r\n\r\n-- inline --\r\n\r\n" + (String)MultipartUtility.getContent(part);
 37  
 			}
 38  
 		}
 39  0
 		return true;
 40  
 	}
 41  
 
 42  
 	public String getText() {
 43  0
 		return text;
 44  
 	}
 45  
 
 46  
 	public static void main(String[] args) throws Exception {
 47  0
 		MimeMessage msg = new MimeMessage(javax.mail.Session.getDefaultInstance(System
 48  0
 				.getProperties(), null), System.in);
 49  0
 		PlainPartExtractor h = new PlainPartExtractor();
 50  0
 		MultipartUtility.process(msg, h);
 51  
 
 52  0
 		System.out.println("This is the detected text/plain parts.");
 53  0
 		System.out.println(h.getText());
 54  0
 	}
 55  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.