Class 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 the FileItemFactory interface.
    • 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 new InMemoryFileItem 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InMemoryFileItemFactory

        public InMemoryFileItemFactory()
    • 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 new InMemoryFileItem instance from the supplied parameters and the local factory configuration.
        Specified by:
        createItem in interface org.apache.commons.fileupload.FileItemFactory
        Parameters:
        fieldName - the name of the form field
        contentType - the content type of the form field
        isFormField - true if this is a plain form field; false otherwise
        fileName - 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, the InMemoryFileItem 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)