You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.component.upload.receivers.

Class FileBuffer

    • Constructor Detail

      • FileBuffer

        public FileBuffer()

        Creates a file buffer with a default file factory.

        Files will be created using File.createTempFile(String, String) and have that build 'upload_tmpfile_{FILENAME}_{currentTimeMillis}'

      • FileBuffer

        public FileBuffer​(FileFactory factory)

        Creates a file buffer that uses a file factory to create a custom upload File.

        Parameters:

        factory - file factory for file buffer

    • Method Detail

      • receiveUpload

        public OutputStream receiveUpload​(String fileName,
                                          String mimeType)

        Description copied from interface: Receiver

        Invoked when a new upload arrives.

        Specified by:

        receiveUpload in interface Receiver

        Parameters:

        fileName - the desired filename of the upload, usually as specified by the client

        mimeType - the MIME type of the uploaded file

        Returns:

        stream to which the uploaded file should be written

      • getFileData

        public FileData getFileData()

        Get the file data object.

        Returns:

        file data for the latest upload or null

      • getFileName

        public String getFileName()

        Get the file name for this buffer.

        Returns:

        file name or empty if no file

      • getFileDescriptor

        public FileDescriptor getFileDescriptor()

        Get the output stream for file.

        Returns:

        file output stream or null if not available

      • getInputStream

        public InputStream getInputStream()

        Get the input stream for file.

        Returns:

        input stream for file or empty stream if file not found