Class InMemoryFileItemFactory
- java.lang.Object
-
- com.aspectran.web.support.multipart.inmemory.InMemoryFileItemFactory
-
- All Implemented Interfaces:
org.apache.commons.fileupload.FileItemFactory
public class InMemoryFileItemFactory extends java.lang.Object implements org.apache.commons.fileupload.FileItemFactory
The class is an implementation of theFileItemFactory
interface.
-
-
Constructor Summary
Constructors Constructor Description InMemoryFileItemFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.fileupload.FileItem
createItem(java.lang.String fieldName, java.lang.String contentType, boolean isFormField, java.lang.String fileName)
Create a newInMemoryFileItem
instance from the supplied parameters and the local factory configuration.int
getSizeThreshold()
Returns the size threshold for storing data in memory.void
setSizeThreshold(int sizeThreshold)
Sets the size threshold for storing data in memory.
-
-
-
Method Detail
-
createItem
public org.apache.commons.fileupload.FileItem createItem(java.lang.String fieldName, java.lang.String contentType, boolean isFormField, java.lang.String fileName)
Create a newInMemoryFileItem
instance from the supplied parameters and the local factory configuration.- Specified by:
createItem
in interfaceorg.apache.commons.fileupload.FileItemFactory
- Parameters:
fieldName
- the name of the form fieldcontentType
- the content type of the form fieldisFormField
-true
if this is a plain form field;false
otherwisefileName
- the name of the uploaded file, if any, as supplied by the browser or other client- Returns:
- the newly created file item
-
setSizeThreshold
public void setSizeThreshold(int sizeThreshold)
Sets the size threshold for storing data in memory. If this value is exceeded, theInMemoryFileItem
will throw an error.- Parameters:
sizeThreshold
- the size threshold, in bytes- See Also:
getSizeThreshold()
-
getSizeThreshold
public int getSizeThreshold()
Returns the size threshold for storing data in memory. The default value is Integer.MAX_VALUE bytes (2 GB approx).- Returns:
- the size threshold, in bytes.
- See Also:
setSizeThreshold(int)
-
-