|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nih.nci.caarray.ui.core.CustomCommonsFormFile
public class CustomCommonsFormFile
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
.
Constructor Summary | |
---|---|
CustomCommonsFormFile(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. |
void |
write(java.io.File file)
Delegates to the org.apache.commons.fileupload.FileItem of
the Apache Commons FileUpload framework. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CustomCommonsFormFile(org.apache.commons.fileupload.FileItem fileItem)
fileItem
- The Commons file item to be wrapped.Method Detail |
---|
public java.lang.String getContentType()
getContentType
in interface org.apache.struts.upload.FormFile
public void setContentType(java.lang.String contentType)
NOTE: This method is not supported in this implementation.
setContentType
in interface org.apache.struts.upload.FormFile
contentType
- A string representing the content type.public int getFileSize()
getFileSize
in interface org.apache.struts.upload.FormFile
public void setFileSize(int filesize)
NOTE: This method is not supported in this implementation.
setFileSize
in interface org.apache.struts.upload.FormFile
filesize
- The size of the file, in bytes.public java.lang.String getFileName()
getFileName
in interface org.apache.struts.upload.FormFile
public void setFileName(java.lang.String fileName)
NOTE: This method is not supported in this implementation.
setFileName
in interface org.apache.struts.upload.FormFile
fileName
- 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 org.apache.struts.upload.FormFile
java.io.FileNotFoundException
- If some sort of file representation cannot be found for
the FormFile
java.io.IOException
- If there is some sort of IOExceptionpublic java.io.InputStream getInputStream() throws java.io.FileNotFoundException, java.io.IOException
getInputStream
in interface org.apache.struts.upload.FormFile
java.io.FileNotFoundException
- If some sort of file representation cannot be found for
the FormFile
java.io.IOException
- If there is some sort of IOExceptionpublic void destroy()
destroy
in interface org.apache.struts.upload.FormFile
protected 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
public void write(java.io.File file) throws java.lang.Exception
org.apache.commons.fileupload.FileItem
of
the Apache Commons FileUpload framework.
write
in interface CustomFormFile
file
- the new file to write
java.lang.Exception
- any exceptions raised while writing the new file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |