|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.struts.upload.CommonsMultipartRequestHandler.CommonsFormFile
This class implements the Struts 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 | |
(package private) org.apache.commons.fileupload.FileItem |
fileItem
The FileItem instance wrapped by this object. |
| Constructor Summary | |
CommonsMultipartRequestHandler.CommonsFormFile(org.apache.commons.fileupload.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 java.lang.String |
getBaseFileName(java.lang.String filePath)
Returns the base file name from the supplied file path. |
java.lang.String |
getContentType()
Returns the content type for this file. |
byte[] |
getFileData()
Returns the data for this file as a byte array. |
java.lang.String |
getFileName()
Returns the (client-side) file name for this file. |
int |
getFileSize()
Returns the size, in bytes, of this file. |
java.io.InputStream |
getInputStream()
Get an InputStream that represents this file. |
void |
setContentType(java.lang.String contentType)
Sets the content type for this file. |
void |
setFileName(java.lang.String fileName)
Sets the (client-side) file name for this file. |
void |
setFileSize(int filesize)
Sets the size, in bytes, for this file. |
java.lang.String |
toString()
Returns the (client-side) file name for this file. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
org.apache.commons.fileupload.FileItem fileItem
FileItem instance wrapped by this object.| Constructor Detail |
public CommonsMultipartRequestHandler.CommonsFormFile(org.apache.commons.fileupload.FileItem fileItem)
fileItem - The Commons file item to be wrapped.| Method Detail |
public java.lang.String getContentType()
getContentType in interface FormFilepublic void setContentType(java.lang.String contentType)
NOTE: This method is not supported in this implementation.
setContentType in interface FormFilecontentType - A string representing the content type.public int getFileSize()
getFileSize in interface FormFilepublic void setFileSize(int filesize)
NOTE: This method is not supported in this implementation.
setFileSize in interface FormFilefilesize - The size of the file, in bytes.public java.lang.String getFileName()
getFileName in interface FormFilepublic void setFileName(java.lang.String fileName)
NOTE: This method is not supported in this implementation.
setFileName in interface FormFilefileName - The client-side name for the file.
public byte[] getFileData()
throws java.io.FileNotFoundException,
java.io.IOException
getInputStream method is encouraged
as an alternative.getFileData in interface FormFilejava.io.FileNotFoundException - If some sort of file representation
cannot be found for the FormFilejava.io.IOException - If there is some sort of IOException
public java.io.InputStream getInputStream()
throws java.io.FileNotFoundException,
java.io.IOException
getInputStream in interface FormFilejava.io.FileNotFoundException - If some sort of file representation
cannot be found for the FormFilejava.io.IOException - If there is some sort of IOExceptionpublic void destroy()
destroy in interface FormFileprotected java.lang.String getBaseFileName(java.lang.String filePath)
File.getName() correctly for Windows
paths, so we attempt to take care of that here.filePath - The full path to the file.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||