Interface DiskFileItemFactory


  • public interface DiskFileItemFactory

    A factory interface for creating FileItem and Media instances. Factories can provide their own custom configuration, over and above that provided by the default file upload implementation.
    Unlike FileItemFactory, this factory needs two extra information, sizeThreshold and repository.

    Since:
    8.0.2
    Author:
    jumperchen
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.apache.commons.fileupload2.core.FileItem createItem​(java.lang.String fieldName, java.lang.String contentType, boolean isFormField, java.lang.String fileName, int sizeThreshold, java.io.File repository)
      Create a new FileItem instance from the supplied parameters and any local factory configuration.
      Media createMedia​(org.apache.commons.fileupload2.core.FileItem fileItem, java.lang.String contentType, java.lang.String fileName, boolean isNative)
      Create a new Media instance from from the supplied parameters and any local factory configuration.
    • Method Detail

      • createItem

        org.apache.commons.fileupload2.core.FileItem createItem​(java.lang.String fieldName,
                                                                java.lang.String contentType,
                                                                boolean isFormField,
                                                                java.lang.String fileName,
                                                                int sizeThreshold,
                                                                java.io.File repository)
        Create a new FileItem instance from the supplied parameters and any local factory configuration.
        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.
        sizeThreshold - The threshold, in bytes, below which items will be retained in memory and above which they will be stored as a file, if any.
        repository - The data repository, which is the directory in which files will be created, should the item size exceed the threshold, if any.
        Returns:
        The newly created file item.
      • createMedia

        Media createMedia​(org.apache.commons.fileupload2.core.FileItem fileItem,
                          java.lang.String contentType,
                          java.lang.String fileName,
                          boolean isNative)
        Create a new Media instance from from the supplied parameters and any local factory configuration.
        Parameters:
        fileItem - The instance of the upload file.
        contentType - The content type of the form field.
        fileName - The name of the uploaded file, if any, as supplied by the browser or other client.
        isNative - whether the file item is a binary type.
        Returns:
        The newly created media.