com.ozacc.mail.fetch.impl.sk_jp
クラス AttachmentsExtractor

java.lang.Object
  上位を拡張 com.ozacc.mail.fetch.impl.sk_jp.AttachmentsExtractor
すべての実装されたインタフェース:
PartHandler

public class AttachmentsExtractor
extends Object
implements PartHandler

添付ファイルを抽出するPartHandlerです。

MultipartUtility#process()呼び出し後にgetFileNames()によって、 添付ファイル名の配列を得ることができます。

ファイル名配列のindexを指定してその添付ファイルに対する InputStreamを得たり、渡されたOutputStreamに対して書き出すことができます。

バージョン:
$Revision: 1.1.2.2 $ $Date: 2005/09/25 12:51:38 $
作成者:
Shin

フィールドの概要
static int MODE_IGNORE_INLINE
          Content-Disposition: inline; パートはfilenameがあっても無視します。
static int MODE_IGNORE_MESSAGE
          message/*のパートを無視します。
 
コンストラクタの概要
AttachmentsExtractor()
          添付ファイル一覧を得るためのPartHandlerを作成します。
AttachmentsExtractor(int mode)
          添付ファイル一覧を得るためのPartHandlerを作成します。
 
メソッドの概要
 String getContentType(int index)
          指定添付ファイルのContent-Typeを返します。
 int getCount()
          添付ファイル個数を返します。
 String getFileName(int index)
          指定添付ファイルのファイル名を返します。
 String[] getFileNames()
          添付ファイル名の配列を返します。
 InputStream getInputStream(int index)
          指定添付ファイルを読み込むストリームを返します。
 int getSize(int index)
          指定添付ファイルのサイズを返します。
static void main(String[] args)
           
 boolean processPart(javax.mail.Part part, javax.mail.internet.ContentType context)
          MultipartUtility#process()から呼びだされるメソッドです。
 void writeTo(int index, OutputStream out)
          指定添付ファイルを指定ストリームに書き出します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

MODE_IGNORE_MESSAGE

public static final int MODE_IGNORE_MESSAGE
message/*のパートを無視します。

関連項目:
定数フィールド値

MODE_IGNORE_INLINE

public static final int MODE_IGNORE_INLINE
Content-Disposition: inline; パートはfilenameがあっても無視します。

関連項目:
定数フィールド値
コンストラクタの詳細

AttachmentsExtractor

public AttachmentsExtractor()
添付ファイル一覧を得るためのPartHandlerを作成します。 message/*のパートやinline且つファイル名指定ありのパートも 添付ファイルとして扱います。


AttachmentsExtractor

public AttachmentsExtractor(int mode)
添付ファイル一覧を得るためのPartHandlerを作成します。

パラメータ:
mode - 動作モード。MODE_で始まる識別子をor指定します。
メソッドの詳細

processPart

public boolean processPart(javax.mail.Part part,
                           javax.mail.internet.ContentType context)
                    throws javax.mail.MessagingException,
                           IOException
MultipartUtility#process()から呼びだされるメソッドです。

定義:
インタフェース PartHandler 内の processPart
戻り値:
true:次のパート、或いは内包メッセージ内部も処理する
例外:
javax.mail.MessagingException
IOException

getCount

public int getCount()
添付ファイル個数を返します。


getFileNames

public String[] getFileNames()
                      throws javax.mail.MessagingException
添付ファイル名の配列を返します。

添付ファイルが存在しない場合は空の配列を返します。
ファイル名は同一のものが複数存在する事もありえます。

例外:
javax.mail.MessagingException

getFileName

public String getFileName(int index)
                   throws javax.mail.MessagingException
指定添付ファイルのファイル名を返します。

例外:
javax.mail.MessagingException

getContentType

public String getContentType(int index)
                      throws javax.mail.MessagingException
指定添付ファイルのContent-Typeを返します。

例外:
javax.mail.MessagingException

getSize

public int getSize(int index)
            throws javax.mail.MessagingException
指定添付ファイルのサイズを返します。

例外:
javax.mail.MessagingException

getInputStream

public InputStream getInputStream(int index)
                           throws javax.mail.MessagingException,
                                  IOException
指定添付ファイルを読み込むストリームを返します。

例外:
javax.mail.MessagingException
IOException

writeTo

public void writeTo(int index,
                    OutputStream out)
             throws javax.mail.MessagingException,
                    IOException
指定添付ファイルを指定ストリームに書き出します。

例外:
javax.mail.MessagingException
IOException

main

public static void main(String[] args)
                 throws Exception
例外:
Exception


Copyright © 2004-2006 OZACC. All Rights Reserved.