org.apache.struts.upload
Interface FormFile

All Known Implementing Classes:
DiskFile

public interface FormFile

This interface is used to define a file uploaded by a client.


Method Summary
 void destroy()
          Destroy all content for this form file.
 java.lang.String getContentType()
          Get the content type for this file.
 byte[] getFileData()
          Get the data in byte array for for this file.
 java.lang.String getFileName()
          Get the file name of this file.
 int getFileSize()
          Get the size of this file
 java.io.InputStream getInputStream()
          Get an InputStream that represents this file.
 void setContentType(java.lang.String contentType)
          Set the content type for this file
 void setFileName(java.lang.String fileName)
          Set the filename of this file
 void setFileSize(int filesize)
          Set the file size
 

Method Detail

getContentType

public java.lang.String getContentType()
Get the content type for this file.
Returns:
A String representing content type

setContentType

public void setContentType(java.lang.String contentType)
Set the content type for this file
Parameters:
contentType - The content type

getFileSize

public int getFileSize()
Get the size of this file
Returns:
An int representing the size of the file in bytes

setFileSize

public void setFileSize(int filesize)
Set the file size
Parameters:
filesize - An int reprsenting the size of the file in bytes

getFileName

public java.lang.String getFileName()
Get the file name of this file.
Returns:
A String reprsenting a file name

setFileName

public void setFileName(java.lang.String fileName)
Set the filename of this file
Parameters:
fileName - The name of the file

getFileData

public byte[] getFileData()
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Get the data in byte array for for this file. Note that this can be a very hazardous method, files can be large enough to cause OutOfMemoryErrors. Short of being deprecated, it's strongly recommended that you use getInputStream to get the file data.
Returns:
An array of bytes representing the data contained in the form file
Throws:
java.io.FileNotFoundException - If some sort of file representation cannot be found for the FormFile
java.io.IOException - If there is some sort of IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Get an InputStream that represents this file. This is the preferred method of getting file data.
Throws:
java.io.FileNotFoundException - If some sort of file representation cannot be found for the FormFile
java.io.IOException - If there is some sort of IOException

destroy

public void destroy()
Destroy all content for this form file. Implementations should remove any temporary files or any temporary file data stored somewhere


Copyright © 2000-2001 - Apache Software Foundation