org.apache.struts.upload
インタフェース FormFile

既知の実装クラスの一覧:
CommonsMultipartRequestHandler.CommonsFormFile, DiskFile

public interface FormFile

This interface represents a file that has been uploaded by a client. It is the only interface or class in upload package which is typically referenced directly by a Struts application.


メソッドの概要
 void destroy()
          Destroys all content for the uploaded file, including any underlying data files.
 java.lang.String getContentType()
          Returns the content type for this file.
 byte[] getFileData()
          Returns the data for the entire file as byte array.
 java.lang.String getFileName()
          Returns the file name of this file.
 int getFileSize()
          Returns the size of this file.
 java.io.InputStream getInputStream()
          Returns an input stream for this file.
 void setContentType(java.lang.String contentType)
          Sets the content type for this file.
 void setFileName(java.lang.String fileName)
          Sets the file name of this file.
 void setFileSize(int fileSize)
          Sets the file size.
 

メソッドの詳細

getContentType

public java.lang.String getContentType()
Returns the content type for this file.

戻り値:
A String representing content type.

setContentType

public void setContentType(java.lang.String contentType)
Sets the content type for this file.

パラメータ:
contentType - The content type for the file.

getFileSize

public int getFileSize()
Returns the size of this file.

戻り値:
The size of the file, in bytes.

setFileSize

public void setFileSize(int fileSize)
Sets the file size.

パラメータ:
fileSize - The size of the file, in bytes,

getFileName

public java.lang.String getFileName()
Returns the file name of this file. This is the base name of the file, as supplied by the user when the file was uploaded.

戻り値:
The base file name.

setFileName

public void setFileName(java.lang.String fileName)
Sets the file name of this file.

パラメータ:
fileName - The base file name.

getFileData

public byte[] getFileData()
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Returns the data for the entire file as byte array. Care is needed when using this method, since a large upload could easily exhaust available memory. The preferred method for accessing the file data is getInputStream.

戻り値:
The file data as a byte array.
例外:
java.io.FileNotFoundException - if the uploaded file is not found.
java.io.IOException - if an error occurred while reading the file.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Returns an input stream for this file. The caller must close the stream when it is no longer needed.

例外:
java.io.FileNotFoundException - if the uploaded file is not found.
java.io.IOException - if an error occurred while reading the file.

destroy

public void destroy()
Destroys all content for the uploaded file, including any underlying data files.



このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2003 - Apache Software Foundation