|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||
このクラスはクライアントから受け取る multipart/form-data
のPOSTリクエスト内のファイルまたはアイテムを表現したものです。
multipart/form-data POST request. FileUpload
からこのクラスインスタンスを取得した後
( #parseRequest(javax.servlet.http.HttpServletRequest) を参照) 、
get() メソッドを使ってすべてのファイルの内容を(メモリ上に)取得するか、
getInputStream() メソッドを使って InputStream
を取得し、メモリ上に展開することなくファイルを処理する
(大きなファイルを扱う場合に有用)かを選択することができます。
このインターフェイスは(めったに使われない依存関係を避けるため)
javax.activation.DataSource を継承していませんが、
定義されたいくつかのメソッドはこのインターフェイスとまったく同じ名称で定義されています。
そのため、このインターフェイスの実装クラスに最低限の修正を加えることで
javax.activation.DataSource も実装することができます。
javax.activation.DataSource per se (to avoid a seldom used
dependency), several of the defined methods are specifically defined with
the same signatures as methods in that interface. This allows an
implementation of this interface to also implement
javax.activation.DataSource with minimal additional work.
| メソッドの概要 | |
void |
delete()
関係する一時ディスク領域も含むストレージ上のファイルアイテムを削除します。 |
byte[] |
get()
ファイルアイテムの内容をバイト配列で返します。 |
String |
getContentType()
ブラウザによって付加されたコンテントタイプを返します。 |
String |
getFieldName()
ファイルアイテムに対応したマルチパートフォームフィールド名を返します。 |
InputStream |
getInputStream()
ファイルの内容を取得するための InputStream
を返します。
|
String |
getName()
ブラウザ(または他のクライアントソフトウェア)によって渡された クライアントのファイルシステム上でのオリジナルのファイル名を返します。 |
OutputStream |
getOutputStream()
ファイルの内容を保持するための OutputStream を返します。
|
long |
getSize()
ファイルアイテムのサイズを返します。 |
String |
getString()
デフォルトのキャラクタエンコーディングを使用してファイルアイテムの内容の文字列表現を返します。 |
String |
getString(String encoding)
指定されたエンコーディングを使用してファイルアイテムの内容の文字列表現を返します。 |
boolean |
isFormField()
FileItem インスタンスが単純なフォームフィールドを示すかどうかを判断します。
|
boolean |
isInMemory()
ファイルの内容をメモリ上から読み込むことができるかどうかを示します。 |
void |
setFieldName(String name)
このファイルアイテムを参照するためのフィールド名を設定します。 |
void |
setFormField(boolean state)
FileItem インスタンスが単純なフォームフィールドを示すかどうかを設定します。
|
void |
write(File file)
アップロードアイテムをディスクに書き出すための簡易メソッドです。 |
| メソッドの詳細 |
public InputStream getInputStream()
throws IOException
InputStream
を返します。
InputStream 。
IOException - エラーが発生した場合。
public String getContentType()
null を返します。
null if
not defined.
null。
null if
not defined.public String getName()
public boolean isInMemory()
true ファイルの内容をメモリ上から読み込むことができる場合;
false その他の場合。
true if the file contents will be read from memory;
false otherwise.public long getSize()
public byte[] get()
public String getString(String encoding)
throws UnsupportedEncodingException
get() メソッドを使用します。
encoding - 使用するキャラクタエンコーディング。
UnsupportedEncodingException - 指定されたエンコーディングが利用できなかった場合。
public String getString()
get() メソッドを使用します。
public void write(File file)
throws Exception
このメソッドは同じアイテムに対して複数回コールされた場合、処理を保証しません。 この事は特別な実装を可能とします。 たとえばファイル名の変更はファイルのデータをすべてコピーするよりも 非常に大きなパフォーマンスのメリットをもたらします。
file - アップロードアイテムの出力先となる 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.
public String getFieldName()
public void setFieldName(String name)
name - フォームフィールド名。
public boolean isFormField()
FileItem インスタンスが単純なフォームフィールドを示すかどうかを判断します。
FileItem instance represents
a simple form field.
true インスタンスが単純なフォームフィールドを示す場合;
false インスタンスがアップロードされたファイルを示す場合。
true if the instance represents a simple form
field; false if it represents an uploaded file.public void setFormField(boolean state)
FileItem インスタンスが単純なフォームフィールドを示すかどうかを設定します。
FileItem instance represents
a simple form field.
state - true インスタンスが単純なフォームフィールドを示す場合;
false インスタンスがアップロードされたファイルを示す場合。
true if the instance represents a simple form
field; false if it represents an uploaded file.
public OutputStream getOutputStream()
throws IOException
OutputStream を返します。
OutputStream 。
IOException - エラーが発生した場合。
|
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | ||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | ||||||||