Class CompletedFileUploadRequest

java.lang.Object
io.micronaut.objectstorage.request.CompletedFileUploadRequest
All Implemented Interfaces:
UploadRequest

public class CompletedFileUploadRequest extends Object implements UploadRequest
An UploadRequest backed by a CompletedFileUpload.
Since:
1.0
Author:
Álvaro Sánchez-Mariscal
  • Constructor Details

    • CompletedFileUploadRequest

      public CompletedFileUploadRequest(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload)
    • CompletedFileUploadRequest

      public CompletedFileUploadRequest(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull String key)
    • CompletedFileUploadRequest

      public CompletedFileUploadRequest(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull String key, @NonNull Map<String,String> metadata)
  • Method Details

    • getContentType

      public @NonNull Optional<String> getContentType()
      Specified by:
      getContentType in interface UploadRequest
      Returns:
      the content type of this upload request.
    • getKey

      public @NonNull String getKey()
      Specified by:
      getKey in interface UploadRequest
      Returns:
      the file name with path.
    • getContentSize

      public @NonNull Optional<Long> getContentSize()
      Specified by:
      getContentSize in interface UploadRequest
      Returns:
      the size of the file, in bytes.
    • getInputStream

      public @NonNull InputStream getInputStream()
      Description copied from interface: UploadRequest
      Returns an input stream of the object to be stored.

      Callers must not access the stream while an upload is in progress. Provider implementations may close it, so callers that own the stream should ensure it is closed after a blocking upload returns or after a reactive upload terminates.

      Specified by:
      getInputStream in interface UploadRequest
      Returns:
      an input stream of the object to be stored.
    • getMetadata

      public @NonNull Map<String,String> getMetadata()
      Specified by:
      getMetadata in interface UploadRequest
      Returns:
      a map with key-value pairs to be stored along the file. An empty map by default.
    • setMetadata

      public void setMetadata(@NonNull Map<String,String> metadata)
      Specified by:
      setMetadata in interface UploadRequest
      Parameters:
      metadata - a map with key-value pairs to be stored along the file.