org.apache.struts.upload
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
contentType
Deprecated.
The content type of the file
|
protected java.lang.String |
fileName
Deprecated.
The name of the file
|
protected java.lang.String |
filePath
Deprecated.
The filepath to the temporary file
|
protected int |
fileSize
Deprecated.
The size in bytes of the file
|
Constructor and Description |
---|
DiskFile(java.lang.String filePath)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Deprecated.
Delete the temporary file.
|
java.lang.String |
getContentType()
Deprecated.
Get the content type
|
byte[] |
getFileData()
Deprecated.
Attempt to read the temporary file and get it's data in byte
array form.
|
byte[] |
getFileData(int bufferSize)
Deprecated.
Attempts to read a file n bytes at a time, n being equal to "bufferSize".
|
java.lang.String |
getFileName()
Deprecated.
Get the file name
|
java.lang.String |
getFilePath()
Deprecated.
Get the temporary file path for this form file
|
int |
getFileSize()
Deprecated.
Get the file size
|
java.io.InputStream |
getInputStream()
Deprecated.
Returns a FileInputStream to the file
|
void |
setContentType(java.lang.String contentType)
Deprecated.
Set the content type
|
void |
setFileName(java.lang.String filename)
Deprecated.
Set the file name
|
void |
setFileSize(int fileSize)
Deprecated.
Set the file size
|
protected java.lang.String filePath
protected java.lang.String contentType
protected int fileSize
protected java.lang.String fileName
public byte[] getFileData() throws java.io.FileNotFoundException, java.io.IOException
getFileData(int)
.
Note that this method can be dangerous, and that the size of a file
can cause an OutOfMemoryError quite easily. You should use
getInputStream
and do your own thing.getFileData
in interface FormFile
java.io.FileNotFoundException
- If the temp file no longer existsjava.io.IOException
- if there is some sort of IO problem.getFileData(int)
public byte[] getFileData(int bufferSize) throws java.io.FileNotFoundException, java.io.IOException
getInputStream
and do your own thing.bufferSize
- The size in bytes that are read from the file at a timejava.io.FileNotFoundException
- If the temp file no longer existsjava.io.IOException
public void destroy()
public java.lang.String getFilePath()
public void setFileName(java.lang.String filename)
setFileName
in interface FormFile
filename
- The base file name.public void setContentType(java.lang.String contentType)
setContentType
in interface FormFile
contentType
- The content type for the file.public void setFileSize(int fileSize)
setFileSize
in interface FormFile
fileSize
- The size of the file in bytespublic java.lang.String getFileName()
getFileName
in interface FormFile
public java.lang.String getContentType()
getContentType
in interface FormFile
public int getFileSize()
getFileSize
in interface FormFile
public java.io.InputStream getInputStream() throws java.io.FileNotFoundException, java.io.IOException
getInputStream
in interface FormFile
java.io.FileNotFoundException
- if the uploaded file is not found.java.io.IOException
- if an error occurred while reading the
file.Copyright ? 2000-2014 - The Apache Software Foundation