org.apache.struts.upload
static class CommonsMultipartRequestHandler.CommonsFormFile extends Object implements FormFile, Serializable
FormFile
interface by
wrapping the Commons FileUpload FileItem
interface. This
implementation is read-only; any attempt to modify an instance
of this class will result in an UnsupportedOperationException
.
Field Summary | |
---|---|
FileItem | fileItem
The FileItem instance wrapped by this object. |
Constructor Summary | |
---|---|
CommonsFormFile(FileItem fileItem)
Constructs an instance of this class which wraps the supplied
file item.
|
Method Summary | |
---|---|
void | destroy()
Destroy all content for this form file.
|
protected String | getBaseFileName(String filePath)
Returns the base file name from the supplied file path. |
String | getContentType()
Returns the content type for this file.
|
byte[] | getFileData()
Returns the data for this file as a byte array. |
String | getFileName()
Returns the (client-side) file name for this file.
|
int | getFileSize()
Returns the size, in bytes, of this file.
|
InputStream | getInputStream()
Get an InputStream that represents this file. |
void | setContentType(String contentType)
Sets the content type for this file.
|
void | setFileName(String fileName)
Sets the (client-side) file name for this file.
|
void | setFileSize(int filesize)
Sets the size, in bytes, for this file.
|
String | toString()
Returns the (client-side) file name for this file.
|
FileItem
instance wrapped by this object.Parameters: fileItem The Commons file item to be wrapped.
File.getName()
correctly for Windows
paths, so we attempt to take care of that here.
Parameters: filePath The full path to the file.
Returns: The base file name, from the end of the path.
Returns: A String representing content type.
Returns: An array of bytes representing the data contained in this form file.
Throws: FileNotFoundException If some sort of file representation cannot be found for the FormFile IOException If there is some sort of IOException
Returns: The client-size file name.
Returns: The size of the file, in bytes.
Throws: FileNotFoundException If some sort of file representation cannot be found for the FormFile IOException If there is some sort of IOException
NOTE: This method is not supported in this implementation.
Parameters: contentType A string representing the content type.
NOTE: This method is not supported in this implementation.
Parameters: fileName The client-side name for the file.
NOTE: This method is not supported in this implementation.
Parameters: filesize The size of the file, in bytes.
Returns: The client-size file name.