public class ReactiveGridFsResource extends Object implements GridFsObject<Object,org.reactivestreams.Publisher<DataBuffer>>
GridFsObject.Options| Constructor and Description |
|---|
ReactiveGridFsResource(Object id,
String filename,
GridFsObject.Options options,
com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
Creates a new, absent
ReactiveGridFsResource. |
ReactiveGridFsResource(String filename,
com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
Creates a new, absent
ReactiveGridFsResource. |
| Modifier and Type | Method and Description |
|---|---|
static ReactiveGridFsResource |
absent(String filename)
Obtain an absent
ReactiveGridFsResource. |
boolean |
exists() |
reactor.core.publisher.Flux<DataBuffer> |
getContent()
The actual file content.
|
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream()
Obtain the download stream emitting chunks of data as they come in.
|
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream(int chunkSize)
Obtain the download stream emitting chunks of data with given
chunkSize as they come in. |
Object |
getFileId()
The
GridFSFile.getId() value converted into its simple java type. |
String |
getFilename()
The filename.
|
reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> |
getGridFSFile() |
reactor.core.publisher.Mono<InputStream> |
getInputStream()
Obtain the data as
InputStream. |
GridFsObject.Options |
getOptions()
Additional information like file metadata (eg. contentType).
|
public ReactiveGridFsResource(String filename, @Nullable com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
ReactiveGridFsResource.filename - filename of the absent resource.downloadPublisher - public ReactiveGridFsResource(@Nullable Object id, String filename, GridFsObject.Options options, @Nullable com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
ReactiveGridFsResource.id - filename - filename of the absent resource.options - downloadPublisher - public static ReactiveGridFsResource absent(String filename)
ReactiveGridFsResource.filename - filename of the absent resource, must not be null.public Object getFileId()
GridFsObjectGridFSFile.getId() value converted into its simple java type. BsonString will be converted to plain String.getFileId in interface GridFsObject<Object,org.reactivestreams.Publisher<DataBuffer>>public String getFilename() throws IllegalStateException
GridFsObjectgetFilename in interface GridFsObject<Object,org.reactivestreams.Publisher<DataBuffer>>IllegalStateExceptionAbstractResource.getFilename()public reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> getGridFSFile()
GridFSFile. Can be null if absent.public reactor.core.publisher.Mono<InputStream> getInputStream() throws IllegalStateException
InputStream. getDownloadStream() for large files.IllegalStateException - if the underlying Publisher has already been consumed.InputStreamResource.getInputStream(),
getDownloadStream(),
DataBufferUtils.join(Publisher)public reactor.core.publisher.Flux<DataBuffer> getDownloadStream()
Flux.empty() if the file does not exist.IllegalStateException - if the underlying Publisher has already been consumed.InputStreamResource.getInputStream(),
getDownloadStream(),
DataBufferUtils.join(Publisher)public reactor.core.publisher.Flux<DataBuffer> getContent()
GridFsObjectgetContent in interface GridFsObject<Object,org.reactivestreams.Publisher<DataBuffer>>public GridFsObject.Options getOptions()
GridFsObjectgetOptions in interface GridFsObject<Object,org.reactivestreams.Publisher<DataBuffer>>public reactor.core.publisher.Flux<DataBuffer> getDownloadStream(int chunkSize)
chunkSize as they come in.chunkSize - the preferred number of bytes per emitted DataBuffer.Flux.empty() if the file does not exist.IllegalStateException - if the underlying Publisher has already been consumed.InputStreamResource.getInputStream(),
getDownloadStream(),
DataBufferUtils.join(Publisher)public boolean exists()
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.