public class UploadedFile extends Object
Modifier and Type | Field and Description |
---|---|
private String |
filename |
private String |
formName |
private FileUpload |
fu |
private String |
mimeType |
Constructor and Description |
---|
UploadedFile(FileUpload fu,
String formName,
String filename,
String mimeType)
Create a new
UploadedFile object. |
Modifier and Type | Method and Description |
---|---|
String |
getExtension()
Get the extension of the original filename.
|
String |
getFilename()
Get the original filename of the uploaded file.
|
String |
getFormName()
Get the name of the form field that this file was selected in.
|
InputStream |
getInputStream()
Get an input stream for uploading the file.
|
String |
getMimeType()
Get the MIME type of the uploaded file.
|
void |
writeTo(OutputStream out)
Upload the file and write the data to the specified output stream.
|
private FileUpload fu
private final String formName
private final String filename
private final String mimeType
UploadedFile(FileUpload fu, String formName, String filename, 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 String getFormName()
public String getFilename()
public String getExtension()
public String getMimeType()
public void writeTo(OutputStream out) throws IOException, UploadAbortedException
out
- The stream to write toIOException
UploadAbortedException
public InputStream getInputStream() throws IOException, UploadAbortedException
IOException
- If reading the input stream fails.UploadAbortedException
- If the upload has been requested to be aborted.