Class PendingFileUpload

    • Constructor Detail

      • PendingFileUpload

        public PendingFileUpload​(String filePath,
                                 String fileName,
                                 long fileSize,
                                 String contentType)
        Creates a new pending file upload with the given file path, file name, file size and content type.
        Parameters:
        filePath - The path to the file on the file system.
        fileName - The original file name of the uploaded file, may be different from the file name on the file system.
        fileSize - The size of the file in bytes.
        contentType - The content type of the file, e.g. "application/pdf".
    • Method Detail

      • getContentType

        public String getContentType()
        The content type of the file, e.g. "application/pdf".
        Returns:
        The content type of the file.
      • getFileName

        public String getFileName()
        The original file name of the uploaded file, may be different from the file name on the file system.
        Returns:
        The original file name of the uploaded file.
      • getFilePath

        public String getFilePath()
        The path file on the file system with the data of the uploaded file.
        Returns:
        The file on the file system with the data of the uploaded file.
      • getFileSize

        public long getFileSize()
        The size of the file in bytes.
        Returns:
        The size of the file in bytes.
      • getId

        public String getId()
        The unique identifier of the pending file upload. Can be used e.g. to remove a pending file upload from a list of pending file uploads.
        Returns:
        The unique identifier of the pending file upload.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • fromUploadedFile

        public static PendingFileUpload fromUploadedFile​(org.primefaces.model.file.UploadedFile file)
                                                  throws IOException
        Creates a PendingFileUpload from an UploadedFile. Creates a temporary file in the application's temp directory, copies the content of the uploaded file to the temporary file and returns a new instance of PendingFileUpload with the path to the temporary file and the file's metadata.
        Parameters:
        file - The uploaded file to create a PendingFileUpload from.
        Returns:
        A new instance of PendingFileUpload with the path to the temporary file and the file's metadata.
        Throws:
        IOException - If an I/O error occurs while copying the content of the uploaded file to the temporary file.