Class BytesUploadRequest

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

public class BytesUploadRequest extends AbstractUploadRequest implements UploadRequest
Upload request implementation using byte array.
Since:
1.0
Author:
Burt Beckwith
  • Constructor Details

    • BytesUploadRequest

      public BytesUploadRequest(@NonNull byte[] bytes, @NonNull String key)
    • BytesUploadRequest

      public BytesUploadRequest(@NonNull byte[] bytes, @NonNull String key, @NonNull String contentType)
    • BytesUploadRequest

      public BytesUploadRequest(@NonNull byte[] bytes, @Nullable String contentType, @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.
    • getBytes

      public @NonNull byte[] getBytes()
      Returns:
      the byte array source.