public interface UploadRequest
Modifier and Type | Method and Description |
---|---|
static UploadRequest |
fromBytes(byte[] bytes,
java.lang.String key) |
static UploadRequest |
fromBytes(byte[] bytes,
java.lang.String key,
java.lang.String contentType) |
static UploadRequest |
fromCompletedFileUpload(io.micronaut.http.multipart.CompletedFileUpload completedFileUpload) |
static UploadRequest |
fromCompletedFileUpload(io.micronaut.http.multipart.CompletedFileUpload completedFileUpload,
java.lang.String key) |
static UploadRequest |
fromPath(java.nio.file.Path path) |
static UploadRequest |
fromPath(java.nio.file.Path path,
java.lang.String prefix) |
java.util.Optional<java.lang.Long> |
getContentSize() |
java.util.Optional<java.lang.String> |
getContentType() |
java.io.InputStream |
getInputStream() |
java.lang.String |
getKey() |
default java.util.Map<java.lang.String,java.lang.String> |
getMetadata() |
default void |
setContentType(java.lang.String contentType) |
default void |
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata) |
@NonNull static UploadRequest fromPath(@NonNull java.nio.file.Path path)
path
- the path to the file.UploadRequest
from the given path.@NonNull static UploadRequest fromPath(@NonNull java.nio.file.Path path, @NonNull java.lang.String prefix)
path
- the path to the file.prefix
- the prefix under which the file will be stored (prefix/fileName
).UploadRequest
from the given path and prefix@NonNull static UploadRequest fromBytes(@NonNull byte[] bytes, @NonNull java.lang.String key)
bytes
- the source byte array.key
- the key under which the file will be stored (path/to/file
)UploadRequest
from the given byte array and key@NonNull static UploadRequest fromBytes(@NonNull byte[] bytes, @NonNull java.lang.String key, @NonNull java.lang.String contentType)
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.UploadRequest
from the given parameters.@NonNull static UploadRequest fromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload)
completedFileUpload
- the CompletedFileUpload
.UploadRequest
from the given CompletedFileUpload
.@NonNull static UploadRequest fromCompletedFileUpload(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull java.lang.String key)
completedFileUpload
- the CompletedFileUpload
.key
- the key under which the file will be stored (path/to/file
)UploadRequest
from the given CompletedFileUpload
and key.@NonNull java.util.Optional<java.lang.String> getContentType()
@NonNull java.lang.String getKey()
@NonNull java.util.Optional<java.lang.Long> getContentSize()
@NonNull java.io.InputStream getInputStream()
@NonNull default java.util.Map<java.lang.String,java.lang.String> getMetadata()
default void setMetadata(@NonNull java.util.Map<java.lang.String,java.lang.String> metadata)
metadata
- a map with key-value pairs to be stored along the file.default void setContentType(@NonNull java.lang.String contentType)
contentType
- the content type of this upload request.