public class UploadedFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
filename |
private java.lang.String |
formName |
private FileUpload |
fu |
private java.lang.String |
mimeType |
Constructor and Description |
---|
UploadedFile(FileUpload fu,
java.lang.String formName,
java.lang.String filename,
java.lang.String mimeType)
Create a new
UploadedFile object. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getExtension()
Get the extension of the original filename.
|
java.lang.String |
getFilename()
Get the original filename of the uploaded file.
|
java.lang.String |
getFormName()
Get the name of the form field that this file was selected in.
|
java.io.InputStream |
getInputStream()
Get an input stream for uploading the file.
|
java.lang.String |
getMimeType()
Get the MIME type of the uploaded file.
|
void |
writeTo(java.io.OutputStream out)
Upload the file and write the data to the specified output stream.
|
private FileUpload fu
private final java.lang.String formName
private final java.lang.String filename
private final java.lang.String mimeType
UploadedFile(FileUpload fu, java.lang.String formName, java.lang.String filename, java.lang.String mimeType)
UploadedFile
object.
Use the FileUpload.getFile(String)
or FileUpload.getFileValues(String)
method to get an object representing the uploaded file.fu
- The FileUpload
object responsible for the uploadformName
- The name of the form field with this filemimeType
- The MIME type of the file, or NULL if it is not knownfilename
- The original filename of the file, or NULL if it is not knownpublic java.lang.String getFormName()
public java.lang.String getFilename()
public java.lang.String getExtension()
public java.lang.String getMimeType()
public void writeTo(java.io.OutputStream out) throws java.io.IOException, UploadAbortedException
out
- The stream to write tojava.io.IOException
UploadAbortedException
public java.io.InputStream getInputStream() throws java.io.IOException, UploadAbortedException
java.io.IOException
- If reading the input stream fails.UploadAbortedException
- If the upload has been requested to be aborted.