org.apache.commons.fileupload
クラス DefaultFileItemFactory

java.lang.Object
  拡張org.apache.commons.fileupload.DefaultFileItemFactory
すべての実装インタフェース:
FileItemFactory

public class DefaultFileItemFactory
extends Object
implements FileItemFactory

FileItemFactory インターフェイスの標準実装です。 この実装は、アイテムが小さければメモリに、大きければディスクに保存する FileItem インスタンスを生成します。 ファイルをディスクに保存するサイズの閾値と、その一時ファイルを保存する ディレクトリは設定することが可能です。

The default {@link org.apache.commons.fileupload.FileItemFactory} implementation. This implementation creates {@link org.apache.commons.fileupload.FileItem} instances which keep their content either in memory, for smaller items, or in a temporary file on disk, for larger items. The size threshold, above which content will be stored on disk, is configurable, as is the directory in which temporary files will be created.

設定を行わなかった場合、初期設定は以下の通りです:

If not otherwise configured, the default configuration values are as follows:

バージョン:
$Id: DefaultFileItemFactory.java,v 1.5 2004/04/07 04:00:48 hioki Exp $
作成者:
Martin Cooper
翻訳者:
日置 聡
校正者:
入江 弘憲
翻訳状況:
校了

フィールドの概要
static int DEFAULT_SIZE_THRESHOLD
          アップロード時にこのサイズを超えたらディスクに保存する閾値の初期値。
private  File repository
          ディスク上にアップロードデータを保存する場合のディレクトリ。
private  int sizeThreshold
          アップロード時にこのサイズを超えたらディスクに保存する閾値。
 
コンストラクタの概要
DefaultFileItemFactory()
          未設定のクラスインスタンスを生成します。
DefaultFileItemFactory(int sizeThreshold, File repository)
          設定済みのクラスインスタンスを生成します。
 
メソッドの概要
 FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName)
          渡されたパラメータと、このファクトリ内の設定から新しい DefaultFileItem を生成します。
 File getRepository()
          設定された閾値のサイズを超えた一時ファイルが保存されるディレクトリを返します。
 int getSizeThreshold()
          これを超えたらディスク上にファイルを保存するサイズ閾値を返します。
 void setRepository(File repository)
          設定された閾値のサイズを超えた一時ファイルが保存されるディレクトリを設定します。
 void setSizeThreshold(int sizeThreshold)
          これを超えたらディスク上にファイルを保存するサイズ閾値を設定します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

DEFAULT_SIZE_THRESHOLD

public static final int DEFAULT_SIZE_THRESHOLD
アップロード時にこのサイズを超えたらディスクに保存する閾値の初期値。
The default threshold above which uploads will be stored on disk.

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

repository

private File repository
ディスク上にアップロードデータを保存する場合のディレクトリ。
The directory in which uploaded files will be stored, if stored on disk.


sizeThreshold

private int sizeThreshold
アップロード時にこのサイズを超えたらディスクに保存する閾値。
The threshold above which uploads will be stored on disk.

コンストラクタの詳細

DefaultFileItemFactory

public DefaultFileItemFactory()
未設定のクラスインスタンスを生成します。 ファクトリ(このクラス)を生成の後、適切なセッターメソッドにて設定を行うことができます。
Constructs an unconfigured instance of this class. The resulting factory may be configured by calling the appropriate setter methods.


DefaultFileItemFactory

public DefaultFileItemFactory(int sizeThreshold,
                              File repository)
設定済みのクラスインスタンスを生成します。
Constructs a preconfigured instance of this class.

パラメータ:
sizeThreshold - これより小さければメモリ上に、大きければファイルとして アイテムを保持するバイト単位の閾値。
The threshold, in bytes, below which items will be retained in memory and above which they will be stored as a file.
repository - アイテムのサイズが閾値を越えた際に、 ファイルの保存先となるディレクトリ。
The data repository, which is the directory in which files will be created, should the item size exceed the threshold.
メソッドの詳細

getRepository

public File getRepository()
設定された閾値のサイズを超えた一時ファイルが保存されるディレクトリを返します。
Returns the directory used to temporarily store files that are larger than the configured size threshold.

戻り値:
一時ファイルが保存されるディレクトリ。
The directory in which temporary files will be located.
関連項目:
setRepository(java.io.File)

setRepository

public void setRepository(File repository)
設定された閾値のサイズを超えた一時ファイルが保存されるディレクトリを設定します。
Sets the directory used to temporarily store files that are larger than the configured size threshold.

パラメータ:
repository - 一時ファイルが保存されるディレクトリ。
The directory in which temporary files will be located.
関連項目:
getRepository()

getSizeThreshold

public int getSizeThreshold()
これを超えたらディスク上にファイルを保存するサイズ閾値を返します。 初期値は1024バイトです。
[訳注: 10240バイトが正しい初期値です。]
Returns the size threshold beyond which files are written directly to disk. The default value is 1024 bytes.

戻り値:
バイトのサイズ閾値。
The size threshold, in bytes.
関連項目:
setSizeThreshold(int)

setSizeThreshold

public void setSizeThreshold(int sizeThreshold)
これを超えたらディスク上にファイルを保存するサイズ閾値を設定します。
Sets the size threshold beyond which files are written directly to disk.

パラメータ:
sizeThreshold - バイト単位のサイズ閾値。
sizeThreshold The size threshold, in bytes.
関連項目:
getSizeThreshold()

createItem

public FileItem createItem(String fieldName,
                           String contentType,
                           boolean isFormField,
                           String fileName)
渡されたパラメータと、このファクトリ内の設定から新しい DefaultFileItem を生成します。
Create a new {@link org.apache.commons.fileupload.DefaultFileItem} instance from the supplied parameters and the local factory configuration.

定義:
インタフェース FileItemFactory 内の createItem
パラメータ:
fieldName - フォームフィールド名。
The name of the form field.
contentType - フォームフィールドのコンテントタイプ。
The content type of the form field.
isFormField - true 単純なフォームフィールドを示す場合; false それ以外の場合。
true if this is a plain form field; false otherwise.
fileName - ブラウザまたは他のクライアントから渡されたアップロードファイル名。
The name of the uploaded file, if any, as supplied by the browser or other client.
戻り値:
新規に作成されたファイルアイテム。
The newly created file item.


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation