Interface UploadRequest
- All Known Implementing Classes:
AbstractUploadRequest, BytesUploadRequest, CompletedFileUploadRequest, FileUploadRequest, StreamingFileUploadRequest
public interface UploadRequest
Object storage upload request.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull UploadRequeststatic @NonNull UploadRequeststatic @NonNull UploadRequestfromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload) static @NonNull UploadRequestfromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull String key) static @NonNull UploadRequeststatic @NonNull UploadRequeststatic @NonNull UploadRequestfromStreamingFileUpload(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload) static @NonNull UploadRequestfromStreamingFileUpload(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload, @NonNull String key) @NonNull InputStream@NonNull StringgetKey()default voidsetContentType(@NonNull String contentType) default voidsetMetadata(@NonNull Map<String, String> metadata)
-
Method Details
-
fromPath
- Parameters:
path- the path to the file.- Returns:
- An
UploadRequestfrom the given path.
-
fromPath
- Parameters:
path- the path to the file.prefix- the prefix under which the file will be stored (prefix/fileName).- Returns:
- An
UploadRequestfrom the given path and prefix
-
fromBytes
- Parameters:
bytes- the source byte array.key- the key under which the file will be stored (path/to/file)- Returns:
- An
UploadRequestfrom the given byte array and key
-
fromBytes
static @NonNull UploadRequest fromBytes(@NonNull byte[] bytes, @NonNull String key, @NonNull String contentType) - Parameters:
bytes- the source byte array.key- the key under which the file will be stored (path/to/file)contentType- the content type of the file to store.- Returns:
- An
UploadRequestfrom the given parameters.
-
fromCompletedFileUpload
static @NonNull UploadRequest fromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload) - Parameters:
completedFileUpload- theCompletedFileUpload.- Returns:
- An
UploadRequestfrom the givenCompletedFileUpload.
-
fromCompletedFileUpload
static @NonNull UploadRequest fromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull String key) - Parameters:
completedFileUpload- theCompletedFileUpload.key- the key under which the file will be stored (path/to/file)- Returns:
- An
UploadRequestfrom the givenCompletedFileUploadand key.
-
fromStreamingFileUpload
static @NonNull UploadRequest fromStreamingFileUpload(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload) - Parameters:
streamingFileUpload- theStreamingFileUpload.- Returns:
- An
UploadRequestfrom the givenStreamingFileUpload. - Since:
- 2.7.0
-
fromStreamingFileUpload
static @NonNull UploadRequest fromStreamingFileUpload(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload, @NonNull String key) - Parameters:
streamingFileUpload- theStreamingFileUpload.key- the key under which the file will be stored (path/to/file)- Returns:
- An
UploadRequestfrom the givenStreamingFileUploadand key. - Since:
- 2.7.0
-
getContentType
-
getKey
@NonNull String getKey()- Returns:
- the file name with path.
-
getContentSize
-
getInputStream
@NonNull InputStream getInputStream()- Returns:
- an input stream of the object to be stored.
-
getMetadata
-
setMetadata
-
setContentType
- Parameters:
contentType- the content type of this upload request.- Since:
- 1.1.0
-