|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
java.lang.Objectorg.apache.commons.fileupload.DefaultFileItem
FileItem
インターフェイスの標準実装です。
DiskFileUpload
からこのクラスインスタンスを取得した後
(#parseRequest(javax.servlet.http.HttpServletRequest)) を参照)、
get() メソッドを使ってすべてのファイルの内容を(メモリ上に)取得するか、
getInputStream() メソッドを使って InputStream
を取得し、メモリ上に展開することなく
ファイルを処理する(大きなファイルを扱う場合に有用)かを選択することができます。
| フィールドの概要 | |
private byte[] |
cachedContent
キャッシュされたファイルの内容。 |
private String |
contentType
ブラウザによって付加されたコンテントタイプ。 |
private static int |
counter
固有の識別子を生成するために使用されるカウンタ。 |
private DeferredFileOutputStream |
dfos
このアイテムの出力ストリーム。 |
private String |
fieldName
ブラウザによって付加されたフォームフィールド名。 |
private String |
fileName
ユーザのファイルシステム上でのオリジナルのファイル名。 |
private boolean |
isFormField
このアイテムが単純なフォームフィールドかどうか。 |
private File |
repository
ディスク上に保持する場合にアップロードファイルが保存されるディレクトリ。 |
private int |
sizeThreshold
アップロードファイルをディスク上に保持するかどうかの閾値。 |
| コンストラクタの概要 | |
(パッケージプライベート) |
DefaultFileItem(String fieldName,
String contentType,
boolean isFormField,
String fileName,
int sizeThreshold,
File repository)
新規 DefaultFileItem インスタンスを生成します。
|
| メソッドの概要 | |
void |
delete()
関係する一時ディスク領域も含むストレージ上のファイルアイテムを削除します。 |
protected void |
finalize()
一時領域からファイルの内容を削除します。 |
byte[] |
get()
ファイルの内容をバイト配列で返します。 |
String |
getContentType()
ブラウザによって付加されたコンテントタイプを返します。 |
String |
getFieldName()
ファイルアイテムに対応したマルチパートフォームフィールド名を返します。 |
InputStream |
getInputStream()
ファイルの内容を取得するための InputStream を返します。
|
String |
getName()
クライアントのファイルシステム上でのオリジナルのファイル名を返します。 |
OutputStream |
getOutputStream()
ファイルの内容を保持するための OutputStream を返します。
|
long |
getSize()
ファイルアイテムのサイズを返します。 |
File |
getStoreLocation()
一時領域に保持されている FileItem のデータを示す File
オブジェクトを返します。
|
String |
getString()
デフォルトのキャラクタエンコーディングを使用してファイルの内容の文字列表現を返します。 |
String |
getString(String encoding)
指定されたエンコーディングを使用してファイルの内容の文字列表現を返します。 |
protected File |
getTempFile()
設定されたリポジトリパス内の固有名称の一時ファイルを表す File を作成して返します。
|
private static String |
getUniqueId()
このクラスをロードするクラスローダ内で固有の(しかしランダムに見えない)識別子を返します。 |
boolean |
isFormField()
FileItem インスタンスが単純なフォームフィールドを示すかどうかを判断します。
|
boolean |
isInMemory()
ファイルの内容をメモリ上から読み込むことができるかどうかを示します。 |
void |
setFieldName(String fieldName)
このファイルアイテムを参照するためのフィールド名を設定します。 |
void |
setFormField(boolean state)
FileItem インスタンスが単純なフォームフィールドを示すかどうかを設定します。
|
void |
write(File file)
アップロードアイテムをディスクに書き出すための簡易メソッドです。 |
| クラス java.lang.Object から継承したメソッド |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
private static int counter
private String fieldName
private String contentType
null if
not defined.
private boolean isFormField
private String fileName
private int sizeThreshold
private File repository
private byte[] cachedContent
private DeferredFileOutputStream dfos
| コンストラクタの詳細 |
DefaultFileItem(String fieldName,
String contentType,
boolean isFormField,
String fileName,
int sizeThreshold,
File repository)
DefaultFileItem インスタンスを生成します。
DefaultFileItem instance.
fieldName - フォームフィールド名。
contentType - ブラウザによって付加されたコンテントタイプ。
定義されていない場合には null 。
null if not specified.isFormField - このアイテムがアップロードファイルではなく
単純なフォームフィールドかどうか。
fileName - ユーザのファイルシステム上でのオリジナルのファイル名。
定義されていない場合には null 。
null if not specified.sizeThreshold - このアイテムがメモリ上に保持されるか、ファイルとして保存されるかの
バイト単位の閾値。
repository - アイテムのサイズが閾値を超えた場合にファイルを生成し
保存するディレクトリの位置。
| メソッドの詳細 |
public InputStream getInputStream()
throws IOException
InputStream を返します。
FileItem 内の getInputStreamInputStream 。
IOException - エラーが発生した場合。
public String getContentType()
null を返します。
null if
not defined.
FileItem 内の getContentTypenull。
null if
not defined.public String getName()
FileItem 内の getNamepublic boolean isInMemory()
FileItem 内の isInMemorytrue ファイルの内容をメモリ上から読み込むことができる場合;
false その他の場合。
true if the file contents will be read
from memory; false otherwise.public long getSize()
FileItem 内の getSizepublic byte[] get()
FileItem 内の get
public String getString(String encoding)
throws UnsupportedEncodingException
get() メソッドを使用します。
FileItem 内の getStringencoding - 使用するキャラクタエンコーディング。
UnsupportedEncodingException - 指定されたエンコーディングが利用できなかった場合。
public String getString()
get() メソッドを使用します。
FileItem 内の getString
public void write(File file)
throws Exception
この実装はもしアイテムがディスク上に展開されている場合、 最初にアップロードアイテムを指定された名称のファイルに変更する事を試みます。 それ以外の場合にはデータを指定されたファイルにコピーします。
このメソッドは、1つのアイテムについて最初に実行された1度だけ、動作することが保証されます。 (1度処理を行った後には)このメソッドは一時ファイルの名称を変更してしまうので、 次にコピーまたは名称の変更をしようとしても、そのファイルはもう既に利用できません。
FileItem 内の writefile - アップロードアイテムの出力先となる File 。
File into which the uploaded item should
be stored.Exception - エラーが発生した場合。
public void delete()
FileItem インスタンスがガベージコレクションにかかった時にこのストレージは削除されますが、
このメソッドは早く確実に削除を実施し、システムリソースを保護します。
FileItem instance is garbage
collected, this method can be used to ensure that this is done at an
earlier time, thus preserving system resources.
FileItem 内の deletepublic String getFieldName()
FileItem 内の getFieldNamesetFieldName(java.lang.String)public void setFieldName(String fieldName)
FileItem 内の setFieldNamefieldName - フォームフィールド名。
getFieldName()public boolean isFormField()
FileItem インスタンスが単純なフォームフィールドを示すかどうかを判断します。
FileItem instance represents
a simple form field.
FileItem 内の isFormFieldtrue インスタンスが単純なフォームフィールドを示す場合;
false インスタンスがアップロードされたファイルを示す場合。
true if the instance represents a simple form
field; false if it represents an uploaded file.setFormField(boolean)public void setFormField(boolean state)
FileItem インスタンスが単純なフォームフィールドを示すかどうかを設定します。
FileItem instance represents
a simple form field.
FileItem 内の setFormFieldstate - true インスタンスが単純なフォームフィールドを示す場合;
false インスタンスがアップロードされたファイルを示す場合。
true if the instance represents a simple form
field; false if it represents an uploaded file.isFormField()
public OutputStream getOutputStream()
throws IOException
OutputStream を返します。
FileItem 内の getOutputStreamOutputStream 。
IOException - エラーが発生した場合。
public File getStoreLocation()
FileItem のデータを示す File
オブジェクトを返します。
FileItem がデータをメモリ上に保持している場合には、
このメソッドは null を返します。
大きなファイルを扱う際には、もし一時領域と移動先の論理ボリュームが同じなら
File.renameTo(java.io.File)
を使ってデータのコピーを行うことなく新しい位置に移動することができます。
FileItem's
data's temporary location on the disk. Note that for
FileItems that have their data stored in memory,
this method will return null. When handling large
files, you can use {@link java.io.File#renameTo(java.io.File)} to
move the file to new location without copying the data, if the
source and destination locations reside within the same logical
volume.
null 。
null if the data is stored in
memory.protected void finalize()
protected File getTempFile()
File を作成して返します。
File 。
private static String getUniqueId()
|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||