org.apache.struts.upload
public class DiskFile extends Object implements FormFile
Deprecated: Use the Commons FileUpload based multipart handler instead. This class will be removed after Struts 1.2.
| Field Summary | |
|---|---|
| protected String | contentType
The content type of the file |
| protected String | fileName
The name of the file |
| protected String | filePath
The filepath to the temporary file |
| protected int | fileSize
The size in bytes of the file |
| Constructor Summary | |
|---|---|
| DiskFile(String filePath) | |
| Method Summary | |
|---|---|
| void | destroy()
Delete the temporary file. |
| String | getContentType()
Get the content type |
| byte[] | getFileData()
Attempt to read the temporary file and get it's data in byte
array form. |
| byte[] | getFileData(int bufferSize)
Attempts to read a file n bytes at a time, n being equal to "bufferSize".
|
| String | getFileName()
Get the file name |
| String | getFilePath()
Get the temporary file path for this form file |
| int | getFileSize()
Get the file size |
| InputStream | getInputStream()
Returns a FileInputStream to the file |
| void | setContentType(String contentType)
Set the content type |
| void | setFileName(String filename)
Set the file name |
| void | setFileSize(int fileSize)
Set the file size |
getFileData(int).
Note that this method can be dangerous, and that the size of a file
can cause an OutOfMemoryError quite easily. You should use
getInputStream and do your own thing.
Throws: FileNotFoundException If the temp file no longer exists IOException if there is some sort of IO problem.
See Also: DiskFile
getInputStream and do your own thing.
Parameters: bufferSize The size in bytes that are read from the file at a time
Throws: FileNotFoundException If the temp file no longer exists
Returns: A filepath to the temporary file
Returns: The size of this file in bytes
Parameters: fileSize The size of the file in bytes