Class FileUploadRequest

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

public class FileUploadRequest extends AbstractUploadRequest implements UploadRequest
Upload request implementation using File.
  • Constructor Details

    • FileUploadRequest

      public FileUploadRequest(@NonNull Path localFilePath)
    • FileUploadRequest

      public FileUploadRequest(@NonNull Path localFilePath, @Nullable String prefix)
    • FileUploadRequest

      public FileUploadRequest(@NonNull Path localFilePath, @NonNull String keyName, @Nullable String prefix, @Nullable String contentType)
    • FileUploadRequest

      public FileUploadRequest(@NonNull String keyName, @Nullable String contentType, @NonNull Path path, @NonNull Map<String,String> metadata)
  • Method Details

    • getFile

      public @NonNull File getFile()
      Returns:
      The File associated with the underlying Path.
    • getPath

      public @NonNull Path getPath()
      Returns:
      The underlying Path.
    • getAbsolutePath

      public @NonNull String getAbsolutePath()
      Returns:
      The absolute path of the underlying Path.
    • 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.