MimeMultipart 내용물 표시하기

public static void dumpMime(MimeMessage mime) { try { MimeMultipart mPart = (MimeMultipart)mime.getContent(); dumpPart(null, mPart); } catch (Exception e) { e.printStackTrace(); } } public static void dumpPart(String parentIndex, MimeMultipart mPart) throws Exception { int count = mPart.getCount(); for (int i = 0; i < count; i++) { BodyPart p = mPart.getBodyPart(i); if ( p == null ) continue; Log.d(“JO”, “[“+((parentIndex==null)?””+i:parentIndex+”:”+i)+”] => ” + p); Log.d(“JO”, “[“+((parentIndex==null)?””+i:parentIndex+”:”+i)+”:ContentType] => ” + p.getContentType()); Log.d(“JO”, “[“+((parentIndex==null)?””+i:parentIndex+”:”+i)+”:DataHandler] => ” + p.getDataHandler()); Log.d(“JO”, “[“+((parentIndex==null)?””+i:parentIndex+”:”+i)+”:FileName] => ” + p.getFileName()); Log.d(“JO”, “[“+((parentIndex==null)?””+i:parentIndex+”:”+i)+”:Content] => ” + p.getContent()); if ( p.getContentType().startsWith(“multipart”) && p.getContent() instanceof MimeMultipart ) { dumpPart((parentIndex==null)?””+i:parentIndex+”:”+i, (MimeMultipart)p.getContent()); } } } ]]>

Related Posts