Class FileParameter
java.lang.Object
com.aspectran.core.activity.request.FileParameter
- Direct Known Subclasses:
CommonsMultipartFileParameter
,InMemoryMultipartFileParameter
The Class FileParameter.
Created: 2008. 04. 11 PM 4:19:40
-
Constructor Summary
ModifierConstructorDescriptionprotected
Instantiates a new FileParameter.FileParameter
(File file) Instantiates a new FileParameter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Delete a file.protected File
determineDestinationFile
(File destFile, boolean overwrite) byte[]
getBytes()
Returns the contents of the file in a byte array.Gets the content type of the file.getFile()
Gets the actual name of the file uploaded.long
Gets the size of the file uploaded.Returns anInputStream
object of the file.Returns the saved file.boolean
Checks if the file is refused.void
release()
Sets the access permission that allow write operations on the file associated with this FileParameter.protected void
void
rollback()
If the saved file exists, delete it.Save an uploaded file as a given destination file.Save a file as a given destination file.void
setRefused
(boolean refused) Sets whether the refused file.protected void
setSavedFile
(File savedFile) toString()
-
Constructor Details
-
FileParameter
protected FileParameter()Instantiates a new FileParameter. -
FileParameter
Instantiates a new FileParameter.- Parameters:
file
- the file
-
-
Method Details
-
getFile
-
getFileName
Gets the actual name of the file uploaded.- Returns:
- the actual name of the file uploaded
-
getFileSize
public long getFileSize()Gets the size of the file uploaded.- Returns:
- the size of the file uploaded
-
getContentType
Gets the content type of the file.- Returns:
- the content type of the file
-
getInputStream
Returns anInputStream
object of the file.- Returns:
- an
OutputStream
that can be used for storing the contents of the file. - Throws:
IOException
- if an I/O error has occurred
-
getBytes
Returns the contents of the file in a byte array. Can not use a large array of memory than the JVM Heap deal.- Returns:
- a byte array
- Throws:
IOException
- if an I/O error has occurred
-
isRefused
public boolean isRefused()Checks if the file is refused.- Returns:
- true if the file is refused; false otherwise
-
setRefused
public void setRefused(boolean refused) Sets whether the refused file.- Parameters:
refused
- whether the file is refused or not
-
saveAs
Save an uploaded file as a given destination file. If the file already exists in directory the save with a different name.- Parameters:
destFile
- the destination file- Returns:
- a saved file
- Throws:
IOException
- if an I/O error has occurred
-
saveAs
Save a file as a given destination file.- Parameters:
destFile
- the destination fileoverwrite
- whether to overwrite if it already exists- Returns:
- a saved file
- Throws:
IOException
- if an I/O error has occurred
-
renameTo
- Throws:
IOException
-
renameTo
- Throws:
IOException
-
determineDestinationFile
- Throws:
IOException
-
getSavedFile
Returns the saved file.- Returns:
- the saved file
-
setSavedFile
-
releaseSavedFile
protected void releaseSavedFile() -
delete
public void delete()Delete a file. -
rollback
public void rollback()If the saved file exists, delete it. -
release
public void release()Sets the access permission that allow write operations on the file associated with this FileParameter. -
toString
-